Create Pay Account (GoPay)

Link customer account - GoPay Tokenizations

Create Pay Account is triggered to link the customer's account to be used for payments using specific payment channel.

HTTP MethodEndpointDefinition
POSTBASE_URL/v2/pay/accountLink the customer account to be used for specific payment channels.


Create Pay Account Request

{
  "payment_type": "gopay",
  "gopay_partner": {
    "phone_number": "81212345678",
    "country_code": "62",
    "redirect_url": "https://www.gojek.com"
  }
}
JSON AttributeDescriptionTypeRequired
payment_typePayment channel where the account is register to.StringRequired
gopay_partnerGoPay linking specific parameters.ObjectConditional
   phone_numberPhone number linked to the customer's account.StringRequired
   country_codeCountry code associated with the phone number.StringRequired
   redirect_urlURL where user is redirected to after finishing the confirmation on Gojek app.StringOptional


Create Pay Account Response

"status_code": "201",
  "payment_type": "gopay",
  "account_id": "00000269-7836-49e5-bc65-e592afafec14",
  "account_status": "PENDING",
  "actions": [
    {
      "name": "activation-link-url",
      "method": "GET",
      "url": "http://api.midtrans.com/v2/gopay/redirect/gpar_6123269-1425-21e3-bc44-e592afafec14/link"
    },
    {
      "name": "activation-link-app",
      "method": "GET",
      "url": "http://api.midtrans.com/v2/gopay/redirect/gpad_6123269-1425-21e3-bc44-e592afafec14/link"
    }
  ]
}
{
  "status_code": "202",
  "payment_type": "gopay",
  "channel_response_code": "105",
  "channel_response_message": "User Not Found"
}
JSON AttributeDescriptionType
status_codeStatus code of the API result.String
payment_typePayment channel associated with the account.String
account_idCustomer account id to be used for payment.String
account_statusStatus of the account. Possible values are PENDING, EXPIRED, ENABLED, and DISABLED.String
channel_response_codeResponse code from payment channel provider.String
channel_response_messageResponse message from payment channel provider.String
actionsFollow up actions to be performed.Array(Object)

Use any one of the two redirection URLs given below.

  • activation-link-url is for customer authentication in browser or WebView. This redirection is recommended for desktop. The customer needs to scan the QR code shown on this page using their Gojek app to verify the linking. Once the linking is verified, then this page is redirected back to the merchant page. For merchants with special agreement with GoPay, this page may show OTP/PIN page instead.

  • activation-link-app is for customer authentication in Gojek app (This might not be applicable for all merchants). The customer needs to input OTP/PIN from the Gojek app.


📘

Note

Merchant can use these phone numbers to perform failed linking scenarios on Sandbox environment

  • User not registered: 123450001
  • User is blocked: 123450002

Pay Account Link Notification

{
  "account_id": "00000269-7836-49e5-bc65-e592afafec14",
  "merchant_id": "M099098",
  "payment_type": "gopay",
  "signature_key": "ad7ccda03d8ec6f2f415661fb511d47fcd17dcc7d7e1ade96a305dd5d3bc2bea5438a8bdfe1aeedabdefb226000338ac169fc18d5ae73788fd5e78dbac945ce4",
  "status_code": "200",
  "account_status": "ENABLED",
  "status_message": "Midtrans account_linked notification"
}

Pay Account link notification will be sent to merchant after user have been redirected to provider app and successfully input their pin/OTP. This notification sample can be seen on the side, and you can see Handle notifications section to know how to handle the notifications.

Specifically for GoPay Tokenization, after notification is recived, merchant needs to call Get Pay Account to fetch the account balance, status, and payment option token.

Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!