How It Works
On Mobile
- The buyer selects Mobile Banking at checkout and chooses their bank.
- They are automatically deep-linked into their bank’s mobile app.
- The buyer authenticates and approves the payment inside the app.
- Once approved, the buyer is returned to the merchant’s app or browser.
On Desktop
- The buyer selects Mobile Banking at checkout and chooses their bank (KTB, KMA, KPlus, or SCB).
- A QR code is displayed on the checkout page.
- The buyer scans the QR code using their phone’s camera or QR scanner.
- The bank’s mobile app opens on their phone, where they authenticate and approve the payment.
- Once approved, the desktop page updates to confirm the payment.
Payment Expiry
The expiry timer starts once the payment attempt is made. The expiry time applies to both the QR code and deep-link flows.| Bank | Expiry Time |
|---|---|
| KPlus (KBank) | 10 minutes |
| SCB | 15 minutes |
| KMA (Krungthai) | 15 minutes |
| KTB (Krungthai) | 15 minutes |
Integrating on your website / application
Step 1: Create a payin
Tazapay uses apayin object to represent your intent to collect a payment from your customer. The payin object tracks state changes from transaction creation to payment completion via mobile banking.Create a payin on your server with an amount, invoice_currency
THB and a transaction_description using the create payin API
A payin is created with the status requires_payment_method.
Sample cURL
Step 2: Confirm a payin
Confirm the payin created in step 1 using the confirm payin API. Upon confirmation of the payin, a redirect URL is generated to redirect the customer. The status of the payin moves torequires_action
Refer the below for the fields to be passed in payment_method_details
| Field | Type | Mandatory (Y/N) | Description |
|---|---|---|---|
| type | string | Y | mobilebanking_thb |
| bank_name | string | Y | Bank code for the customer’s mobile banking app. One of: ktb, kma, kplus, scb |
mobilebanking_thb:
| Field | Type | Mandatory (Y/N) | Description |
|---|---|---|---|
| mobile_number | string | Y | Customer’s mobile number in thai mobile-no format (e.g. +664673826278) |
| session_id | string | Y | Session ID retrieved from the Risk SDK |
Sample cURL
Combining Steps 1 and 2 into a single step
Instead of making 2 API calls, you can also combine steps 1 and 2 into a single API call. To do so, pass the parameters in both the create payin and confirm payin endpoints to the create payin API. Also, pass the following field and set the field to ‘true’| Field | type | Mandatory (Y/N) | Description |
|---|---|---|---|
| confirm | boolean | Y | To confirm the payin along with creation |
Sample cURL
Step 3: Handle the confirm payin response
The confirm payin response differs based on the customer’s device type. Tazapay determines the device from the context of the request.Desktop
For desktop sessions, the response includes aqr_code field inside latest_payment_attempt_data. You must render this QR code on your checkout page. The customer then scans the QR code using their mobile banking app to complete the payment.
Render the latest_payment_attempt_data.qr_code value as a QR code image on your checkout page. The customer scans this with their mobile banking app.
Mobile
For mobile sessions, the response includes adeep_link field inside latest_payment_attempt_data. Since the customer has already provided their mobile number, you only need to redirect them to this deep link. It takes the customer directly into their mobile banking app to authorise and complete the payment.
Redirect the customer to latest_payment_attempt_data.deep_link to take them directly into their mobile banking app to complete the payment.
Full response example
Step 4: Handle post-payment events
Tazapay sends apayin.succeeded event as soon as the funds are received from the customer. Tazapay sends these events to the endpoint configured from your dashboard. You can receive these events and run actions (for example, sending an order confirmation email to your customers, logging the sale in a database, starting a shipping workflow, etc.)
If the payment is not made by the customer and the URL expires, Tazapay sends a payment_attempt.failed event. To generate a new URL, confirm the payin again using Step 2.
| Event | Description | Next Steps |
|---|---|---|
| payin.succeeded | The customer paid before 30 days | Fulfill the goods or services that the customer purchased |
| payment_attempt.failed | The customer did not pay, and the URL expired | Allow the customer to generate a new URL or complete the payment via another payment method |
Test the Integration
Simulating success
Click onSimulate Success CTA on the redirect_url. You will receive a payin.succeeded event.
Simulating Failure / Expiry
Click onSimulate Expire CTA on the redirect_url. You will receive a payment_attempt.failed event.
Integrating Refunds
You can refund a transaction in two ways - using the dashboard or using Refund API. Mobile banking supports partial refunds. Specify the amount (lesser than the invoice amount of the payin) for the refund before initiating.Refunding using dashboard
Refer to this guide: https://support.tazapay.com/how-do-i-request-a-refund-from-my-dashboardRefund using API
Sample cURLFor full refund, specifying the amount and currency is not required to initiate a refund.
