Redirect customers to Snap Checkout page instead of loading Snap UI within your web/app.
There is an alternative method to load Snap UI page instead of calling snap.js, which is window redirection.
Implementation
Merchants can utilize the response value in redirect_url
from the Create Snap Token request. Merchants don't have to load snap.js in their page, as the user is redirected to a page that is hosted by Midtrans.
With this redirection merchant can load Snap page in full window mode view like this:
Track Transaction Status via Query Params
It is possible to track status to be used to trigger your own custom events even for Window Redirection Method. You can do so by listening to URL changes and capture the query parameters appended to the finish URL. You can define after payment's finish & error URL by going to Dashboard > Configurations.
Example:
Merchant URL: https://merchant-callback.com
Redirection Finish URL: https://merchant-callback.com?merchant_id=Mxxxxx&order_id=sample-store-1677583302&status_code=202&transaction_status=deny
Query Parameters | Descriptions |
---|---|
merchant_id | Midtrans merchant account ID |
order_id | Transaction order ID as defined and passed by merchant to Midtrans |
transaction_status | Latest transaction status before redirection happens |
status_code | Transaction's status code. |