Payment Method: GoPay/ShopeePay/Dana

📘

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 merchants can initiate GoPay deeplink transactions using SNAP-based CoreAPI specification.

1. Access Token B2B

Path/{version}/access-token/b2b
SNAP service code73
HTTP MethodPOST
Versionv1.0

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 asymmetric signature SHA256withRSA algorithm
X-CLIENT-KEYStringMClient’s client_id (PJP Name) (given at completion registration process).
Content-type: application/json
X-TIMESTAMP: 2024-03-19T14:30:00+07:00
X-SIGNATURE: da1fa417c72d6b91c257e01e54fac824
X-CLIENT-KEY:962489e9-de5d-4eb7-92a4-b07d44d64bf4 

Request Body

Field NameField TypeMandatoryField Description
grantTypeString(64)Mclient_credentials: The client can request an access token using only its client credentials (or other supported means of authentication) when the client is requesting access to the protected resources under its control (OAuth 2.0: RFC 6749 & 6750)
{
   "grantType":"client_credentials"
}

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:2024-03-19T14:30: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.
accessTokenString(2048)CA string representing an authorization issued to the client that used to access protected resources
tokenTypeStringOThe access token type provides the client with the information required to successfully utilize the access token to make a protected resource request
expiresInStringOTime duration when the accessToken will be expired. (default in second).
{
   "responseCode":"2007400",
   "responseMessage":"Successful",
  "accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMTFlZThiMi1hN2FlLTRhZGUtYmJlYS1mNzI3MDk3ZmQ0NmEiLCJjbGllbnRJZCI6IjZhZTk1N2M0LTI4NjMtNDcxMy1hY2NlLWJhMTJkZTYzNmNmYyIsIm5iZiI6MTYxMTQ2ODk3OCwiZXhwIjoxNjExNDY5ODc4LCJpYXQiOjE2MTE0Njg5Nzh9.KM7yz9GvuUaDR1bXwei4iO0h4e3g4o1Hct5Ie9VoBdo",
   "tokenType":"Bearer",
   "expiresIn":"900"
}

Response Body Error Case

Field NameField TypeMandatoryField Description
responseCodeString(7)MError code to specify the error returned
responseMessageString(150)MDebug message to provide more information.
referenceNoStringCDebug id to provide more information.
{
   "responseCode":"5007300",
   "responseMessage":"Timeout",
   "referenceNo":"19352694-0ef6-4439-8ad1-b1dfb8bbb85f"
}

List of Response code

Response CodeHTTP Status CodeResponse Message
2007300200Success
4017300401Unauthorized. Signature
5007300500Internal Server Error

2. Creating GoPay/ShopeePay/Dana deeplink transaction


GoPay/ShopeePay/Dana deeplink - Direct Debit 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 from Access Token B2B API response.
X-PARTNER-IDStringMUnique identifier for partner
X-EXTERNAL-IDStringMAlphanumeric string. Preferably UUID.
CHANNEL-IDStringMMandatory field from Bank Indonesia that can take any value with correct format 5 digits numeric string
Content-type: application/json
X-TIMESTAMP: 2024-03-19T14:30:00+07:00
X-SIGNATURE: da1fa417c72d6b91c257e01e54fac824
Authorization: Bearer gp9HjjEj813Y9JGoqwOeOPWbnt4CupvIJbU1Mmu4a11MNDZ7Sg5u9a
X-PARTNER-ID: BMRI
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

chargeTokenString(40)MAuthorization token. Same as the Authorization header.
merchantIdString(64)OMerchant identifier that is unique per each merchant
validUpToString(25)OThe time when the payment will be automatically expired. The format is defined by ISO 8601.

(Minimum value : 20 second, default value : 15 min)

Maximum value for gopay: 180 days from trx time,
Maximum value for shopeepay: 5 days from trx timeMaximum value for dana: 1 days from trx time
urlParamsArray of ObjectOMerchant redirect URL. After completing payment, user will be redirected back to this URL.if it's not provided, the system will fallback to using the callback url from the dashboard configuration. In case the Midtrans dashboard configuration value is also unavailable, the system will return an error.
urlParams.urlString(512)MURL value
urlParams.typeString(32)MURL type
Possible 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

payOptionDetailsArray of ObjectMPayment option that will be used for this payment.
payOptionDetails.payMethodString(64)MPayment method for the transaction.Possible value : GOPAY, SHOPEEPAY, DANA
payOptionDetails.payOptionString(64)MPayment option which shows the provider of this paymentPossible value : GOPAY, SHOPEEPAY, DANA
payOptionDetails.transAmountObjectMPayment Transaction Amount
payOptionDetails.transAmount.valueString(ISO 4217)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

payOptionDetails.transAmount.currencyString(3)MTransaction currency that will be paid using this payment method.Possible Value: IDR
additionalInfoObjectOAdditional information field which merchants need to pass to support current API contracts.
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.billingAddressObjectOCustomer billing address
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
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.shippingAddressObjectOCustomer shipping address
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
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 ObjectOItem Details
additionalInfo.items.idString(32)OItem ID
additionalInfo.items.priceObjectMPrice of the item in IDR.
additionalInfo.items.price.valueString (ISO4217)MItem Price value
additionalInfo.items.price.currencyString(3)MItem Price currency
additionalInfo.items.quantityStringMQuantity of the item purchased by the customer.
additionalInfo.items.nameString(64)OName of the item.
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.items.urlString(64)OHTTP URL of the item in the merchant site
additionalInfo.metadataObjectOTransaction metadata
{
 "partnerReferenceNo": "merchant-order-id",
 "chargeToken": "accessToken",
 "merchantId": "G169749203",
 "urlParams": [{
   "url": "merchantapp://payments/callback/12345",
   "type": "PAY_RETURN",
   "isDeeplink": "Y"
 }],
 "validUpTo": "2023-09-24T20:34:15.452305Z",
 "payOptionDetails": [
   {
     "payMethod": "GOPAY" or "DANA" or "SHOPEEPAY",
     "payOption": "GOPAY" or "DANA" or "SHOPEEPAY",
     "transAmount": {
       "value": "12345678.00",
       "currency": "IDR"
     }
   }
 ],
 "additionalInfo": {
   "customerDetails": {
     "phone": "080123456789",
     "firstName": "john",
     "lastName": "doe",
     "email": "[email protected]",
     "billingAddress": {
       "firstName": "john",
       "lastName": "doe",
       "phone": "080123456789",
       "address": "jalan maju mundur",
       "city": "jakarta",
       "postalCode": "12345",
       "countryCode": "IDN"
     },
     "shippingAddress": {
       "firstName": "john",
       "lastName": "doe",
       "phone": "080123456789",
       "address": "jalan maju mundur",
       "city": "jakarta",
       "postalCode": "12345",
       "countryCode": "IDN"
     }
   },
   "items": [
     {
       "id": "ID012345",
       "price":  {
         "value": "12345678.00",
         "currency": "IDR"
       },
       "quantity":"1",
       "name": "someItemName",
       "brand": "someBrand",
       "category": "someCategory",
       "merchantName": "someMerchant",
       "url": "someItemUrl"
     }
   ],
   "metadata": {}
 }
}

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:2024-03-19T14:30:00+07:00

Response Body

Field NameField TypeMandatoryField Description
responseCodeString(7)MStatus code of transaction charge result.
responseMessageString(150)MDescription of transaction charge result.
referenceNoString(256)CTransaction identifier on service provider system. The field is filled upon successful transaction
partnerReferenceNoString(64)OTransaction identifier on service consumer system
appRedirectUrlString(2048)OReserved for future purposes.
webRedirectUrlString(2048)MReturns a universal link to the PJP AIS payment page. This link is recommended when the Client is unable to implement a check for whether the PJP AIS app is installed on the user's device before redirection.
additionalInfoObjectOAdditional information
additionalInfo.gross_amountObjectOTransaction amount that will be paid using this payment method. The format defined by ISO 4217.
additionalInfo.gross_amount.valueString (ISO4217)MGross amount value
additionalInfo.gross_amount.currencyString(3)MGross amount currency
additionalInfo.paymentTypeString(64)OTransaction payment method
additionalInfo.transactionTimeString(ISO 8601)OTimestamp of transaction in ISO 8601 format using GMT+7.
additionalInfo.validUpToString(ISO 8601)OThe time when the payment will be automatically expired. Using ISO 8601 format
{
 "responseCode":"2005400",
 "responseMessage":"Successful",
 "referenceNo":"GOPAY012345678",
 "partnerReferenceNo":"merchant-order-id",
 "webRedirectUrl":"https://some-url.for/redirect-to-gopay-app",
 "appRedirectUrl":""
 "additionalInfo":{
   "paymentType": "GOPAY",
   "grossAmount":{
     "value": "12345678.00",
     "currency": "IDR"
   },
   "transactionTime":"2023-09-25T02:59:19.517854Z",
   "validUpTo":"2023-09-26T02:59:19Z"
 }

List of Response code

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

Additional APIs

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