Transaction flow using SDK Flow

1843
  1. SDK initialization: The merchant initializes the SDK on the host app.

  2. Transaction token request: The merchant prepares transaction details (e.g., order ID, gross amount) that can include customer and item details, and passes them as a method parameter to the request transaction token method.

  3. Transaction token request: The SDK passes the transaction request body to the merchant server.

  4. POST transaction token request: The merchant server adds a Base64 Authorization header to the request body and sends it to the merchant secure API.

  5. Transaction token response: The Midtrans API returns the transaction token response to the merchant server.

  6. Pass the transaction token: The merchant server passes the transaction token response to the Midtrans SDK.

  7. GET transaction options: The SDK does a GET request to the Midtrans secure API for the available transaction options using the transaction token.

  8. Transaction options response: The Midtrans secure API returns the transaction options response to the SDK.

  9. Display payment list: The mobile SDK receives the response and displays it as a payment list on the host app.

  10. Pay with a selected payment method: The customer can choose their preferred available payment method.

  11. Note: These are additional steps only for payment using a credit card

    11.a.1 Credit card token request: The SDK does a GET request for a credit card token based on the credit card info.

    11.a.2 Credit card token response: The Midtrans secure API returns a credit card token response.

  12. Charge request: The SDK does a POST charge request with the selected payment method to the Midtrans secure API.

  13. Charge response: The Midtrans secure API returns a charge response.

  14. Note for 14.a. These are additional steps only for payment using an e-wallet (ShopeePay, GoPay)
    Note for 14.b These are additional steps only for payment using a credit card with 3DS enabled.

    14.a.1 Open e-wallet app: The SDK automatically opens the e-wallet app via deep link.

    14.a.2 Complete payment on e-wallet app: The customer completes the payment on the e-wallet app.

    14.a.3 Go back to host app: The customer is redirected to the host app via deep link once the payment is completed.

    14.a.4 Transaction status request: The SDK automatically does a GET transaction status request when the host app enters the foreground.

    14.a.5 Transaction status response: The Midtrans secure API returns a transaction status response.

    14.b.1 Open 3DS webview: The SDK automatically opens a 3DS webview for the customer to input the OTP.

    14.b.2 Transaction status request: The SDK automatically does a GET transaction status request after the customer completes their activity on the 3DS webview.

    14.b.3 Transaction status response: The Midtrans secure API returns a transaction status response.

  15. Payment status: The payment status page is shown if enabled (default value is enabled), and then the SDK callback (delegate for iOS) is called. The merchant can put logic here to handle the finished transaction.