Select the appropriate model of ZaloPay integration
Integration steps
Step 1: Select payment model
Step 2: Send a request to create order
Step 3: Generate QR Code
Step 4: Checking order status
Step 5: CallBack from ZaloPay Server
- MerchantClient: Merchant's web/app.
- MerchantServer: Merchant's back-end.
- ZaloPayGateway: ZaloPay Gateway's website.
- ZaloPayServer: ZaloPay's back-end.
When End-user pays the order, the Merchant Client's interface adds a payment model which ZaloPay wallet, following rules:
APIs: Link (orderurl)
Download:
Following, End-user click "Payment" to send a request to create order (step 2)
- After End-user click "Payment", Merchant Client sends a request to create order to Merchant Server.
- Merchant Server call createOrder API of ZaloPay Server.
API: Create order
Merchant Server sends a request to create order to ZaloPay Server (step 2), ZaloPay Server will response results for Merchant Server, which includes orderurl. Merchant Server responses the results to Merchant Client, Merchant Client will use orderurl to generate QR code.
Merchant Client will display the QR code as follows:
Download:
After successfully chaged, ZaloPay will notifi to Merchant Server (`notify(callback)` will call only when the transaction is success). However, the notify may miss due to Network issues/Service Unavailable/..., to provide best customers experience, Merchant should query for the orders status with a frequency of every 1 minute til callback is received or run out of orders time
Note:
- API **Get order's status** is only valid for 48 hours since ZaloPay Server accept the order
- API **Get order's status** can only be used after the Merchant system receives a callback or redirect or 15 minutes after creating order.'
After End-user completes the payment steps on ZaloPay Gateway, if ZaloPay successfully get money from user, then ZaloPay Server will callback (callback/notify) to Merchant Server by CallbackURL which had been registered with ZaloPay
API: callback
After displaying QR for ZaloPay user (step 3), there will be the following cases:
1. End-user completes the payment, ZaloPay Server will callback to Merchant Server. Merchant Server will notify to Merchant Client to display results.
2. Merchant Server does not receive a callback from ZaloPay Server (because End-User does not pay, or network problems), Merchant Server uses order status in step 4 to notify Merchant Client to display the results.