GoPay Linking / Tokenization

GoPay Tokenization is a feature that allows customers to make seamless transaction by linking their account to the merchant's implementation of Snap. Instead of scanning QR or opening deeplink, it will enable users to pay transactions only by inputting their PIN for the already linked account within Snap checkout page without switching app.

Linking Flow

  1. Create SNAP_TOKEN with gopay.tokenization set to true and user_id filled with respective identifier. Merchant can also set gopay.phone_number and gopay.country_code to lock the linking with specific phone number.
  • user_id is a unique identifier owned by merchant that represents a customer. Merchant can use any value in string format with a maximum length of 255. Avoid using values that could be easily linked to a customer like email, ID of records in database etc. Instead, use something like sha512(email/ + salt). Don't expose the user_id to frontends like browser or mobile.

  1. Link your GoPay account option will be shown in the payment list.

  1. User can then input their phone number (if phone number is not sent) or see their phone number (non modifiable) if merchant sent phone_number and country_code in create token request under gopay JSON object.

  1. User will need to input OTP sent by Gojek and GoPay's PIN in order to finish linking.

  1. Customer will then be redirected to the pay screen. After inputting PIN, transaction will be completed.


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": {
    "tokenization": true,
    "phone_number": "628123456789",  
  "user_id": "testuser01"
Transaction Details Object (required)
Unique transaction ID
Item Details Object (optional)
Item details will be paid by customer
Customer Details Object (optional)
Details of the customer
Array (optional)
Set GoPay payment method. Value: gopay
String(255) (optional)
The id of user that will be bind to the GoPay account
GoPay (optional)
GoPay payment options - pass the tokenization param, user_id and target linked phone number here.

Linking and Payment Process Flowchart

Refer to the following chart as a reference for GoPay Tokenization linking and payment flow.


Unlink Account

Merchant can provide the capability for users to unlink the account outside of Snap by sending DELETE request for a specific user_id.

curl --request DELETE \
  --url{user_id}/gopay \
  --header 'Authorization: {merchant_server_key}' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json'

Alternatively, customer can also perform unlinking from Gojek app by tapping Explore at home page > Settings > Apps linked to GoPay.