GoPay is an e-Wallet payment method by Gojek. Users will pay using the Gojek app. The user flow varies when using a Web Browser (on a computer) compared to a SmartPhone.
This API reference describes implementation of regular payment flow with GoPay and QRIS issued by GoPay. To implement GoPay Tokenizations in Snap, see this page.
By default, GoPay Deeplink and QRIS's transaction expiry is 15 minutes (min 20s, max 7 days).
UI Mode
We will show either QRIS or Deeplink based on customer's screen size (wide screen will get QRIS, while small screen will get deeplink). Merchant can however specify whether GoPay will be shown in deeplink or QR format persistently using
options.uiMode
in Snap JS. UI Mode is specified toauto
by default.This guide will assume that the value of
uiMode
in Snap.JS options isauto
, the recommended value.
When users make a purchase using GoPay on a Web Browser(on a computer)
- Users see a QR code on their Web Browser
- Users open the Gojek app on their phone
- Users tap the Pay function on the Gojek app
- Users point their camera to the QR Code
- Users check their payment details on the Gojek app and then tap Pay
-
The transaction is complete and the users' GoPay balance is deducted
-
Midtrans will mark the payment_type of the transaction as
qris
. This will also impact the following:
-
The JSON fields format (returned on Webhook/HTTP Notifications & Get Status API response) is
"payment_type": "qris"
-
The
"payment_type": "qris"
displayed on Midtrans Dashboard, and when you download transactions.
Detailed payment Flow for GoPay on a Desktop PC/Laptop
This is the payment flow if customers process GoPay Payments on a Desktop PC/Laptop.
When users make a purchase on their SmartPhone
- Users are automatically redirected to the Gojek app when making purchases on their SmartPhone
- Users finish the payment on the Gojek app
- The transaction is complete and their GoPay balance is deducted
- Midtrans will mark the payment_type of the transaction as
gopay
. This will also impact the following:
-
The JSON fields format (returned on Webhook/HTTP Notifications & Get Status API response) is
"payment_type": "gopay"
-
The
"payment_type": "gopay"
displayed on Midtrans Dashboard, and when you download transactions.
Note: For a list of failure cases, please refer here.
Detailed Payment Flow for GoPay on a Smartphone
This is the payment flow if customers process GoPay Payments on a smartphone.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "[email protected]",
"phone": "+628123456"
},
"enabled_payments": ["gopay"],
"gopay": {
"enable_callback": true,
"callback_url": "http://gopay.com"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) | Unique transaction ID |
item_details Item Details Object (optional) | Item details will be paid by customer |
customer_details Customer Details Object (optional) | Details of the customer |
enabled_payments Array (optional) | Set what payment method to show in Snap's payment list. Value: gopay |
gopay Gopay (optional) | GoPay payment options |
Implementing GoPay Deeplink Callback
In addition to the standard mobile apps flow, you can implement deeplink callback to redirect customer back from Gojek to your app.
Prerequisites
E-commerce needs to prepare a deeplink which accepts two query parameters.
Query Parameter | Description | Type |
---|---|---|
order_id | Order ID sent on the API Request. | String |
result | Result of the transaction to decide what kind of page to show to customer. Possible values are success or failure . | String |
The steps to integrate with GoPay deeplink (Please look into the GoPay API Request for sample implementation) are given below.
- Set
enable_callback
parameter in the api request totrue
. - Set
callback_url
with the deeplink URL redirecting to E-commerce apps via API request or configure it in Dashboard > Snap Preferences. - Handle redirection with above parameters.
For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
It is highly recommended to avoid using value passed on
result
to update status on backend. There is HTTP notification for this use case.