Payment Method: GoPay Tokenization (non Pre-Auth)

📘

Merchant can now test CoreAPI BI-SNAP flow on Sandbox!

For more details, go here.

This new sandbox will be rolled out to all merchant from October 22nd, 2024. Please contact your sales representative for early access.


📘

GoPay Media Kit

To have a consistent and standardized GoPay branding across platform, we highly recommend merchants to refer to our media kit. Please refer to this page https://gopay.co.id/media-kit to access our brand guideline and image bank.

This section will explain how merchant can initiate GoPay Tokenization (non Pre-Auth) transactions using SNAP-based CoreAPI specification.

  1. In order to do GoPay Tokenization transaction, merchant should link the customer's GoPay account first by initiating the Account Linking API.
  2. Once linked, merchant can create a transaction by calling Direct Debit Payment API.
  3. Merchant can also do other subsequent actions such as Cancel, Refund, and Get Status.
  4. To receive payment notification from Midtrans, merchant will need to also implement Payment Notification API.
📘

GoPay Tokenization in BI-SNAP flow can also support both GoPay & GoPay Later payment. Merchant should pass the corresponding payment option token as payOptionDetails.additionalInfo.paymentoptiontoken in the request body. The payment option token can be retrieved from Binding Inquiry API.

Creating GoPay Tokenization transaction


📘

Redirecting to GoPay page during payment

To learn more on GoPay Tokenization redirection, please refer to these API documentations:

❗️

GoPay may add/change GoPay redirection URL from time to time.

To ensure merchant can always support GoPay flow at all times, we highly suggest merchant to not do explicit URL whitelisting.


GoPay Tokenization - Direct Debit Payment API

Path/{version}/debit/payment-host-to-host
HTTP MethodPOST
Versionv1.0
SNAP service code54

Request Header

Field NameField TypeMandatoryField Description
Content-typeStringMMedia type of the resource, i.e. application/json.
X-TIMESTAMPStringMClient’s current local time in ISO-8601 format.
X-SIGNATUREStringMCreated using symmetric signature HMAC_SHA512 algorithm.
AuthorizationStringMRepresents access_token of a request; string starts with keyword “Bearer ” followed by access_token. Can get this token from Access Token B2B API response.
Authorization-CustomerStringMRepresents access_token of a request; string starts with keyword “Bearer ” followed by access_token from Binding API response.
X-PARTNER-IDStringMUnique identifier for merchant. Provided by Midtrans.
X-EXTERNAL-IDStringMAlphanumeric string. We suggest merchant to use UUID format. The value should be unique. Maximum string length is 36 characters.

In case of timeout, merchant can do:
  1. Use this value in get status API to get status transaction or
  2. Retry this request with the same X-EXTERNAL-ID and request body to avoid creating duplicate transaction
CHANNEL-IDStringMMandatory field from Bank Indonesia that can take any value with correct format 5 digits numeric string
X-DEVICE-IDStringM

Device identification on which the API services are currently being accessed by the end user (customer).

Sample:
Web Application:
Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML, like Gecko)Chrome / 75.0.3770.100 Safari / 537.36 OPR / 62.0.3331.99

Mobile Application:
Android: android-20013adf6cdd8123f
iOS: 72635bdfd223yvjm7246nsdj34hd4559393kjh42

Content-type:application/json
X-TIMESTAMP:2024-03-19T14:30:00+07:00
X-SIGNATURE: da1fa417c72d6b91c257e01e54fac824
Authorization: Bearer gp9HjjEj813Y9JGoqwOeOPWbnt4CupvIJbU1Mmu4a11MNDZ7Sg5u9a
Authorization-Customer: Bearer gp9HjjEj813Y9JGoqwOeOPWbnt4CupvIJbU1Mmu4a11MNDZ7Sg5u9a
X-PARTNER-ID: G123456
X-DEVICE-ID: 0987ADCASA
X-EXTERNAL-ID:12345678901234567890
CHANNEL-ID:12345

Request Body

Field NameField TypeMandatoryField Description
partnerReferenceNoString (64)MMerchant order id.
Note: Allowed Symbols are dash(-), underscore(_), tilde (~), and dot (.). Any request containing unauthorized symbols will be automatically declined.

Only used for debugging purpose in server side

chargeTokenStringMThe account token used to represent the account binding between merchant and GoPay.

We are not sharing accountToken/accessToken with Merchant. Merchant needs to call the Bind Account API to fetch the accountToken/accessToken.

urlParamsArray of ObjectMMerchant redirect URL.

After completing payment, user will be redirected back to this URL

urlParams.urlString(512)MURL value (need to be whitelisted as part of GoPay Tokenization onboarding process)
urlParams.typeString(32)MPossible value : PAY_RETURN
urlParams.isDeeplinkString(1)MThis parameter defines the type of URL to use. Set it to "Y" for a deeplink, or choose "N" if you prefer a standard URL (HTTP/HTTPS)

Possible Value: Y, N

validUpToString(25)OThe time when the payment will be automatically expired. Using ISO 8601 format.

(Maximum value: 180 days from transaction time, minimum value: 20 seconds, default value: 15 minutes)

payOptionDetailsArray of ObjectMPayment option that will be used for this payment

Currently only accept 1 payOptions

payOptionDetails.payMethodString (64)MPayment method. Possible value: GOPAY
payOptionDetails.payOptionString (64)MPayment option which shows the provider of this payment

Possible value: GOPAY_WALLET, PAY_LATER

(Value can be acquired from additionalInfo.paymentOptions.name in Account Binding Inquiry API response)

payOptionDetails.transAmountObjectOPayment transaction amount
payOptionDetails.transAmount.valueString (16,2)MTransaction amount that will be paid using this payment method. If it's IDR then value includes 2 decimal digits.

e.g. IDR 10.000 will be placed as 10000.00

Minimum value: 1.00

Maximum value : 99999999999.00

(item price * item quantity should be the same amount as transAmount)

payOptionDetails.transAmount.currencyString (3)MIDR
payOptionDetails.additionalInfoObjectMAdditional information field which merchants need to pass to support current API contracts.
payOptionDetails.additionalInfo.recurringStringORecurring flag

Possible value : Y/N

If recurring: Y then we will treat this transaction as recurring transaction and bypass PIN challenge. Only applies if recurring feature has already been enabled, please talk to your Midtrans sales representative to have this feature enabled.

payOptionDetails.additionalInfo.promotionIdsArray of StringOList of promotion ID

Promotion ID can be obtained from Get Promotion API.

payOptionDetails.additionalInfo.paymentOptionTokenStringMCan get this from Account Binding Inquriy API response.
additionalInfoObjectOAdditional Information
additionalInfo.merchantCrossReferenceIdString (64)OMerchant cross reference id (payment flow identifier)
additionalInfo.langString (2)OLanguage code for service

Possible values: en, id.
Default value : id.
additionalInfo.customerDetailsObjectOCustomer detail information
additionalInfo.customerDetails.phoneString(15)OCustomer phone number
additionalInfo.customerDetails.emailString(255)OCustomer email
additionalInfo.customerDetails.firstNameString(255)OCustomer first name
additionalInfo.customerDetails.lastNameString(255)OCustomer last name
additionalInfo.customerDetails.billingAddressObjectO
additionalInfo.customerDetails.billingAddress.firstNameString(255)OBilling address first name
additionalInfo.customerDetails.billingAddress.lastNameString(255)OBilling address last name
additionalInfo.customerDetails.billingAddress.phoneString(15)OBilling address phone number
additionalInfo.customerDetails.billingAddress.addressString(255)OBilling address detail
additionalInfo.customerDetails.billingAddress.cityString(255)OBilling address city
additionalInfo.customerDetails.billingAddress.postalCodeString(255)OBilling address postal code
additionalInfo.customerDetails.billingAddress.countryCodeString(15)OBilling address country code
additionalInfo.customerDetails.shippingAddressObjectO
additionalInfo.customerDetails.shippingAddress.firstNameString(255)OShipping address first name
additionalInfo.customerDetails.shippingAddress.lastNameString(255)OShipping address last name
additionalInfo.customerDetails.shippingAddress.phoneString(15)OShipping address phone number
additionalInfo.customerDetails.shippingAddress.addressString(255)OShipping address detail
additionalInfo.customerDetails.shippingAddress.cityString(255)OShipping address city
additionalInfo.customerDetails.shippingAddress.postalCodeString(255)OShipping address postal code
additionalInfo.customerDetails.shippingAddress.countryCodeString(15)OShipping address country code
additionalInfo.itemsArray Of ObjectO
additionalInfo.items.idString(32)OItem ID

Shall merchant intent to apply SKU based promotion, merchant should pass the agreed item ID value for promotion.

additionalInfo.items.priceObjectM
additionalInfo.items.price.valueString (ISO4217)MItem price value (item price * item quantity should be the same amount as transAmount)
additionalInfo.items.price.currencyStringMItem price currency
additionalInfo.items.quantityString(16)MItem quantity (item price * item quantity should be the same amount as transAmount)
additionalInfo.items.nameString(64)MItem name
additionalInfo.items.merchantNameString(64)OName of the merchant selling the item
additionalInfo.items.brandString(64)OBrand name of the item
additionalInfo.items.categoryString(64)OCategory of the item
additionalInfo.metadataObjectOMerchant's metadata
additionalInfo.paymentProviderMetadataObjectCObject containing the payment provider’s metadata parameter. This is used whenever merchant needs to pass additional information to payment provider.In the case of GoPay Later Multi Month transaction, merchant needs to pass the required risk data information as agreed with GoPay Later team.
{
    "partnerReferenceNo": "merchant-order-id",
    "chargeToken": "accessToken",
    "validUpTo": "2023-07-03T10:36:17+07:00",
    "payOptionDetails": [
        {
            "payMethod": "GOPAY",
            "payOption": "GOPAY_WALLET",
            "transAmount": {
                "value": "12345678.00",
                "currency": "IDR"
            },
            "additionalInfo": {
                "paymentOptionToken": "aGoPayWalletToken / aPayLaterToken"
            }
        }
    ],
    "urlParams":[ {
        "url": "https://www.merchant.com/",
        "type": "PAY_RETURN",
        "isDeeplink": "N"
    }],
    "additionalInfo": {
    		"merchantCrossReferenceId": "303b4f89-xxxx-xxxx-xxxx-62a8ffaefaf3",
    		"lang": "en",
        "customerDetails": {
            "phone": "81234532422",
            "firstName": "farz",
            "lastName": "zsasa",
            "email": "[email protected]",
            "billingAddress": {
                "firstName": "billingFirstName",
                "lastName": "billingLastName",
                "phone": "billingPhone",
                "address": "billingAddress",
                "city": "billingCity",
                "postalCode": "12790",
                "countryCode": "CZH"
            },
            "shippingAddress": {
                "firstName": "shippingFirstName",
                "lastName": "shippingLastName",
                "phone": "shippingPhone",
                "address": "shippingAddress",
                "city": "shippingCity",
                "postalCode": "12790",
                "countryCode": "CZH"
            },
        },
        "items": [
            {
                "id": "8za1ieleavwusxn6u5re60ri",
                "price": {
                    "value": "12345678.00",
                    "currency": "IDR"
                },
                "quantity": “1”,
                "name": "Video A",
                "brand": "Some Brand",
                "category": "Subsciption",
                "merchantName": "Amazon Prime"
            }
        ],
        "metadata": {},
        "paymentProviderMetadata": {
            "subOrders": [
                {
                    "subOrderId": "subOrderId001",
                    "periodType": 3,
                    "mainOrderId": <string>,
                    "skuId": "sku2",
                    "skuName": "rice",
                    "categoryId": "categoryId2",
                    "categoryOneName": "mock1",
                    "categoryTwoName": "mock2",
                    "categoryCodes": [],
                    "quantity": 2,
                    "amount": 100000,
                    "discounts": {
                        "funder": <string>,
                        "totalTenor": <int>,
                        "discountDetails": [
	                        "tenor": <int>
	                        "discountType": <string> [DISCOUNT_INTEREST_AMOUNT / DISCOUNT_INTEREST_PERCENTAGE]
	                        "discountAmount": <int>,
	                        "discountRate": <float>,
	                        "extendInfo": {}
                        ]
                    },
                    "merchantId": <string>,
                    "merchantRegisterTime": <long>,
                    "merchantGrade": <string>,
                    "transactionTimestamp": <long>,
                    "merchantName": <string>,
                    "externalMerchantId": <string>,
                    "transactionId": <string>,
                    "serviceType" <int>,
                    "extendInfo": {},
                    "platformInformation": {
                        "merchantUserId": <string>,
                        "firstTransactionDate": "2024/4/12",
                        "latestTransactionDate": "2024/4/12",
                        "successTransactionCount": 30,
                        "successTransactionAmount": 30000000,
                        "successTransactionCountMonthly": 30,
                        "successTransactionAmountMonthly": 30000000,
                        "successCodTransactionCountMonthly": 15,
                        "successCodTransactionAmountMonthly": 30000000,
                        "paidByCreditCard": true/false,
                        "paidByOther": true/false,
                        "paidByEWallet": true/false,
                        "inPayLaterWhitelist": true/false,
                        "inPayLaterBlacklist": true/false,
                        "creditApplicationScore": 501.58,
                        "trxnBehaviorScore: 684.29
                    },
                    "itemInformation": {
                        "itemName": <string>,
                        "categoryName": <string>
                    }
                }
            ],
            "extendInfo": {
                "address": {
                    "address": <string>,
                    "addressId": <string>,
                    "state": <string>,
                    "city": <string>,
                    "shippingName": <string>
                    "shippingPhoneNo": <string>
                },
                "ecommerceOrder": {
                    "orderAmount": 100000,
                    "ecommerceSubOrders": [
                        {
                            "periodType": 3,
                            "subOrderId": "GTF_MOCK",
                            "skuId": "GTF_MOCK",
                            "skuName": "GTF_MOCK",
                            "categoryId": "GTF_MOCK",
                            "categoryOneName": "GTF_MOCK",
                            "categoryTwoName": "GTF_MOCK",
                            "categoryCodes": [
                                "GTF_MOCK"
                            ],
                            "quantity": 1,
                            "amount": 100000,
                            "merchantId": "BLIBLI",
                            "merchantRegisterTime": 0,
                            "merchantGrade": "GTF_MOCK",
                            "transactionTimeStamp": 1674703781574,
                            "extendInfo": {}
                        }
                    ]
                },
                "deviceInfo": {
                    "platform": "string",
                    "gps": {
                        "longitudeHashed": "string",
                        "latitudeHashed": "string",
                        "longitude": "string",
                        "latitude": "string",
                        "time": null
                    },
                    "device": {
                        "deviceId": "string",
                        "isRoot": true,
                        "androidId": "string",
                        "build": {
                            "board": "string",
                            "brand": "string",
                            "cpuAbi": "string",
                            "device": "string",
                            "manufacturer": "string",
                            "model": "string",
                            "product": "string"
                        },
                        "isTampered": true,
                        "isHooked": true,
                        "isEmulators": true
                    },
                    "wifiList": [
                        {
                            "ssid": "string"
                        }
                    ],
                    "ipAddress": {
                        "ethIp": "string",
                        "trueIp": "string"
                    },
                    "appVersion": "string",
                    "advertisingId": "string",
                    "usedByStreamingApps": "string",
                    "widevineId": "string",
                    "dexguardId": "string",
                    "uuid": "string",
                    "deviceIdInUuid": "string"
                }
            }
        }
    }
}

Response Header

Field NameField TypeMandatoryField Description
Content-typeStringMMedia type of the resource, i.e. application/json.
X-TIMESTAMPStringMClient’s current local time in ISO-8601 format.
Content-type: application/json
X-TIMESTAMP: 2020-01-01T00:00:00+07:00

Response Body

Field NameField TypeMandatoryField Description
responseCodeString (7)MError code to specify the error returned.
responseMessageString (150)MDebug message to provide more information.
referenceNoString (256)MUnique transaction identifier from payment provider system e.g : Gopay order ID.

(Only filled if transaction created successfully)

partnerReferenceNoString (32)OUnique transaction identifier from Merchant (Merchant order ID).
webRedirectUrlString (2048)M
  • If merchant is onboarded to Tokenization webview flow: This will return a GoPay PIN webpage. Merchant should open this link to redirect user to GoPay PIN page to complete payment. Merchant should refer to this field if merchant is onboarded to Tokenization webview flow.
  • If merchant is onboarded to Tokenization app redirection flow: This will return a GoPay webpage with a timer as well as payment instructions. User will receive a push notification on their Gojek app to complete payment. Once the customer verifies the transaction on the app, it will be automatically redirected to the merchant page.
  • GoPay may add/change GoPay redirection URL from time to time.To ensure merchant can always support GoPay flow at all times, we highly suggest merchant to not do explicit URL whitelisting.
appRedirectUrlString (2048)MThis will return a universal link to the Gojek/GoPay app. Use this link to redirect user to GoPay PIN page on Gojek/GoPay app for them to complete payment. Merchant should refer to this field if merchant is onboarded to Tokenization app redirection flow. GoPay may add/change GoPay redirection URL from time to time.To ensure merchant can always support GoPay flow at all times, we highly suggest merchant to not do explicit URL whitelisting.
additionalInfoObjectOAdditional information
additionalInfo.amountString (ISO4217)MAmount value
additionalInfo.currencyStringMAmount currency
additionalInfo.statusStringMMidtrans legacy transaction status
additionalInfo.expiryTimeString (ISO8601)MMidtrans legacy expiry transaction time
additionalInfo.paymentTypeStringMPayment type used
additionalInfo.gross_amountObjectM
additionalInfo.gross_amount.valueString (ISO4217)MGross amount value
additionalInfo.gross_amount.currencyStringMGross amount currency
additionalInfo.payOptionDetailsArray of Object.MPayment option detail. This parameter will be deprecated soon. We encourage merchant to not consume this parameter and instead consume the parameter additionalInfo.userPaymentDetails instead.
additionalInfo.payOptionDetails.payMethodStringMPossible value: gopay
additionalInfo.payOptionDetails.payOptionStringMGoPay payment option used.
Possible value:
- GoPay =GOPAY_WALLET
-GoPay Later =PAY_LATER
- GoPay Tabungan by Jago = GOPAY_SAVINGS
additionalInfo.userPaymentDetailsArray of ObjectMPayment used by user
additionalInfo.userPaymentDetails.payMethodStringMPossible value: gopay
additionalInfo.userPaymentDetails.payOptionStringMGoPay payment option used.
Possible value:
- GoPay =GOPAY_WALLET
-GoPay Later =PAY_LATER
- GoPay Tabungan by Jago = GOPAY_SAVINGS
additionalInfo.transactionTimeStringOTimestamp of transaction in ISO 8601 format. Time zone: GMT+7.
additionalInfo.transactionStatusStringOTransaction statusPossible Values:
  • 00 - Success
  • 03 - Pending
  • 04 - Refunded
  • 05 - Canceled
  • 06 - Failed
additionalInfo.fraudStatusStringOFraud status from Midtrans. Possible values:
- accept --> Transaction is safe to proceed. It is not considered as a fraud.
- deny --> Transaction is considered as fraud. It is rejected by Midtrans.
additionalInfo.validUpToString(25)OThe time when the payment will be automatically expired. Using ISO 8601 format.
{
   "responseCode":"20054000",
   "responseMessage":"Request has been processed successfully",
   "referenceNo":"gopay-order-id",
   "partnerReferenceNo":"merchant-order-id",
   "webRedirectUrl":"https://pjsp.com/universal?bizNo=REF993883&...",
   "appRedirectUrl":"https://pjsp.com/universal?bizNo=REF993883&...",
   "additionalInfo":{
      "grossAmount":{
              "value": "12345678.00",
              "currency": "IDR"
       },
      "currency":"IDR",
      "amount": "12345678.00",
      "status": "PENDING",
      "expiryTime": "2024-03-28T07:49:09.00Z"
      "paymentType": "GOPAY",
      "payOptionDetails" : [{
          "payMethod":"gopay",
          "payOption": "GOPAY_WALLET"
       }], 
       "userPaymentDetails" : [{
          "payMethod":"gopay",
          "payOption": "GOPAY_WALLET"
       }], 
      "transactionTime":"2024-03-19T14:30:00+07:00",
      "transactionStatus":"03",  
      "fraudStatus":"accept"  ,
    	"validUpTo":"2023-07-03T10:36:17+07:00"
   }
}
{
   "responseCode":"4001001",
   "responseMessage":"There is some issue with the transaction request",
   "originalExternalId": "merchant-order-id",
}

List of response code

Response CodeHTTP Status CodeResponse Message
2005400200Successful
4005402400Invalid Mandatory Field chargeToken , partnerReferenceNo
4015400401Unauthorized. Auth token required
4015401401Invalid Token (B2B)
4015402401Invalid Customer Token
4035403403Suspected Fraud.
4035405403Inactive Account
4035414403Insufficient Funds
4035415403Transaction Not Permitted. Url not whitelisted.
5005401500Internal Server Error
5045400504Timeout

📘

Redirecting to GoPay page during payment

To learn more on GoPay Tokenization redirection, please refer to these API documentations:

Additional APIs

  1. Refund API
  2. Cancel API
  3. Get Transaction Status API
  4. Payment Notification API