Access Token

Access Token API is an API call that can be used to acquire B2B access token. This access token will be used to access subsequent Transactional API such as payment, refund, query, etc.

  1. Merchant server collects access token by calling ShopeePay system.

  2. ShopeePay will generate the access token and return the token to Merchant.

  3. Access token has validity period, once it passes the validity period client need to collect a new access token.

  4. Merchant can access Transactional API by sending access token on API header.

Specification

The following table is a specification of this API:

HTTP MethodPOST
Service Code73
Path.../v1.0/access-token/b2b
Versionv1.0

Request Parameters

FieldTypeMandatoryDescription
grantTypeStringMGrant Type Value: “client_credentials”

Sample API Request

REQUEST

{
"grantType":"client_credentials"
}
arrow-svg

Copy

Response Parameters

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
accessTokenStringMA string representing an authorization issued to the client that used to access protected resources.
tokenTypeStringMToken Type Value: “Bearer”
expiresInStringMSession expiry in seconds.
  • (default = 900 seconds or 15 minutes)

Sample API Response

RESPONSE

{
"responseCode": "2007300",
"responseMessage": "Successful",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDbGllbnRJRCI6Ik1IMjAyMjA3MDhCIiwiZXhwIjoxNjU4NzIwOTk5NjY5LCJpYXQiOjE2NTg3MTczOTk2NjksImlzcyI6Ik1IMjAyMjA3MDhCIiwibmJmIjoxNjU4NzE3Mzk5NjY5fQ.hv0dubKQTeTR4n2VK_qzf8N3MPUv1wEc8LiMa1eglVc",
"tokenType": "Bearer",
"expiresIn": "900"
}
arrow-svg

Copy

Response Codes

HTTP CodeService CodeSub-Error CodeResponse CodeResponse MessagePartner Action
20073002007300SuccessfulProceed to invoke the next API. The value of “ accessToken” is inserted into HTTP-Header “ Authorization”
40073004007300Bad RequestRetry or contact ShopeePay for support
40073014007301Invalid Field FormatRetry or contact ShopeePay for support
40073024007302Invalid Mandatory Field + {error message}Retry or contact ShopeePay for support
40173004017300Unauthorized.{error message}Retry or contact ShopeePay for support
40173014017301Invalid TokenRetry or contact ShopeePay for support
40973004097300ConflictRetry or contact ShopeePay for support
50073015007301Internal Server ErrorRetry or contact ShopeePay for support
50473005047300TimeoutRetry or contact ShopeePay for support