Link & Pay

Merchant Workflow

To initiate the payment in this scenario, the merchant needs to complete the following steps:

  1. Completed account linking request and store returned account token

  2. Optional: to retrieve user information or coin redemption using account token

  3. Initiate a payment request for Link & Pay when customer selects to pay

The following figure illustrates the workflow of accepting a payment in the Link & Pay payment scenario:

  1. Optionally, before initiating a payment, the merchant can call the two endpoints below based on the use cases
    • Get User Information: ShopeePay will inform the merchant of the customer’s current wallet balance, KYC status etc, should the merchant require any such checks beforehand.
  2. Merchant calls Create Payment Order: Link & Pay endpoint to create payment for the customer. ShopeePay will return a redirect_url for the merchant to allow the user to enter.
  3. Customer selects a payment method and confirms payment.
  4. ShopeePay processes the payment and returns the customer back to the merchant’s page.
  5. ShopeePay will sends an asynchronous message via Notify Payment Status endpoint to inform merchants on the payment result.
  6. Merchants must call the Check Transaction Status endpoint to query the status of the transaction.
    • If the response code is "Success" and the latestTransactionStatus is 00, merchant can mark this transaction as successful.
    • If the response code is "Failed", merchant can mark this transaction as failed.
    • If the transaction is in a processing status, please retry the request at an incremental time range of every 5 seconds (e.g., 5 seconds, 10 seconds, 15 seconds, and so on) up to a maximum of 100 seconds. If there is no response after 100 seconds, please retry the request at an incremental time range of every 5 minutes up to 30 minutes.
    • If the transaction has no response, please retry the request at an incremental time range of every 5 seconds (e.g., 5 seconds, 10 seconds, 15 seconds, and so on) up to a maximum of 100 seconds. If there is no response after 100 seconds, please retry the request at an incremental time range of every 5 minutes up to 30 minutes.
  7. For Refund, if the transaction is in a Processing status or has no response, keep inquiring with an incremental frequency up to 24 hours.

NOTE: When integrating with our LnP product flow, please do not perform any balance validation on the user’s account. Once the user is redirected to ShopeePay, they will have the flexibility to choose from multiple payment methods available other than ShopeePay wallet balance.

Specification

The following table is the specification of the API:

HTTP MethodPOST
Service Code54
Path.../v1.0.2/debit/payment-host-to-host
Versionv1.0.2

Request Parameter

FieldTypeMandatoryDescription
partnerReferenceNoStringMUnique identifier of payment transaction generated by merchant.
merchantIdStringMUnique identifier of merchant in merchant system.
  • Accepts up to 64 characters.
externalStoreIdStringMUnique identifier of store in merchant system.
  • Accepts up to 64 characters.
amountObjectM
  • value
StringMTransaction amount.
  • Sample: 10.000,00 will be placed with 10000.00
  • currency
StringMCurrency that is associated with the payment amount.
  • Accepted values: IDR
validUpToStringO
  • Accepts up to 1,800 seconds (30 mins), from the time request was received
  • If this field is filled, partnerReferenceNo in this request will expire after the specified time period (in seconds) and payment attempt to this partnerReferenceNo will fail.
  • Using ISO 8601 timestamp format.
urlParamsArray of ObjectMArray of object
  • url
StringMIndicates the URL of the merchant's platform to return back to, once the payment on ShopeePay’s page is completed.
  • type
StringMIndicates the type of the sent url.
  • Only accepts ‘PAY_RETURN' value.
  • isDeepLink
StringMIndicates whether the url is a deep link or not.
  • Only accepts either ‘Y’ or ‘N’ value.
additionalInfoObjectO
  • accountToken
StringMThe accountToken used to represent the account binding between Merchant's platform and ShopeePay.
  • useCoin
BooleanOUse this field to indicate whether the customer prefers to use or not to use coins to offset their payment on the merchant’s platform. The default value is set to false.
  • True: attempt to use coins
  • False: do not use coins
  • promoIds
StringOComma separated eligible promoIds of 100 characters or less (up to 20), if any.
  • These promoIds will be checked against promotional campaigns configured in ShopeePay to determine the valid reward amount the customer can receive for this transaction.
  • metadata
StringOAdditional information for the transaction. Additional information for the transaction.
  • This field supports up to 3 fields and needs to be sent in this format {\”field1\”:\”{Data1}\”,\”field2\”:\”{Data2}\” ,\”field3\”:\”{Data3}\”}

Sample API Request

REQUEST

"partnerReferenceNo": "Direct Payment-123",
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"amount": {
"value": "10000.00",
"currency": "IDR"
},
"validUpTo": "2022-07-20T07:00:00+07:00",
"urlParams": [
{
"url": "https://www.test.com",
"type": "PAY_RETURN",
"isDeepLink": "N"
}
],
"additionalInfo": {
"useCoin": true,
"accountToken": "+Tgd0x95GGgt3kN7m1ItWDGqCTAVYysV",
"promoIds": "Promo1, Promo2",
"metadata": "{\"field1\":\"Data1\",\"field2\":\"Data2\",\"field3\":\"Data3\"}"
}
}
arrow-svg

Copy

Response Parameter

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
webRedirectUrlStringOThe URL for the merchant's front-end to redirect the user to ShopeePay's page. Merchant should not impose any kind of restrictions for this URL, such as:
  • Whitelisting only specific domains
  • Restricting specific IPs
  • Limiting URL length
  • The maximum length for the webRedirectUrl parameter is 2048 chars

Sample API Response

JS EXAMPLE

{
"responseCode": "2005400",
"responseMessage": "Successful",
"webRedirectUrl": "https://uat.shopee.id/s/browser/payment/auth/passcode-verify?mode=fullscreen&next=https%3A%2F%2Fuat.shopee.vn%2Fs%2Fbrowser%2Fpayment%2Fauth%2FtokenizedPaymentResult%3Freturn_url%3Dhttps%253A%252F%252Fgoogle.com%26ticket%3DbxfWQkI0VfGzlj7ANMudkMYO9RvkO1PM&return_url=https%3A%2F%2Fuat.shopee.vn%2Fs%2Fbrowser%2Fpayment%2Fauth%2FtokenizedPaymentResult%3Fresult%3D201%26return_url%3Dhttps%253A%252F%252Fgoogle.com%26ticket%3DbxfWQkI0VfGzlj7ANMudkMYO9RvkO1PM&scenario=7cdccb66-cd7a-448f-a01f-b2ddd8970e53&source=TokenizedPayment&ticket=bxfWQkI0VfGzlj7ANMudkMYO9RvkO1PM"
}
arrow-svg

Copy

Response Codes

Please refer to the following description for a general explanation of the responseCode returned during an API Response.

For a more detailed explanation, it is advisable to consult responseMessage. This field provides additional information that can offer valuable insights for troubleshooting.

Merchants may choose to display the responseMessage to their operators or staffs to facilitate prompt identification and resolution of the issue.

HTTP codeService CodeSub-error CodeResponse CodeResponse MessagePartner Action
20054002005400SuccessfulMark LnP (Link&Pay) generate process to Success. Forward customer to Shopeepay page
40054004005400Bad RequestMark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40054014005401
  • Invalid field format {fieldName}
  • Invalid field format {timestamp}
  • Invalid Field Format {validUpTo}
  • Invalid Field Format {promoIds}
  • Invalid Field Format {paymentChannelId}
  • Invalid Field Format {paymentChannelName}
  • Invalid Field Format {paymentMethodName}
  • Invalid Field Format {fraudCheckInfo}
  • Invalid field format {currency}
  • Invalid Field Format {metadata}. Exceed Maximum Characters
  • Invalid Field Format {metadata}. Maximum JSON Key Exceeded
  • Invalid Field Format {metadata}. Invalid JSON Key Name
  • Invalid Field Format {metadata}
  • Invalid Field Format
Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40054024005402
  • Invalid mandatory field {fieldName}
  • Invalid mandatory field {originalPartnerReferenceNo}
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid Mandatory Field {currency}
  • Invalid Mandatory Field {merchantId}
  • Invalid Mandatory Field {pointOfInitiation}
  • Invalid Mandatory Field {externalStoreId}
  • Invalid Mandatory Field {pointOfInitiation} or {accountToken}
  • Invalid Mandatory Field {value}. Non Positive Amount Is Not Allowed
  • Invalid Mandatory Field + {error message}
Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40154004015400
  • Unauthorized. Invalid Client Key
  • Unauthorized.{error message}
Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40154014015401Invalid TokenMark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40354014035401
  • Feature Not Allowed
  • Feature Not Allowed. Selected Payment Channel Is Disabled For Merchant
Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay
40354064035406Feature Not Allowed. Service Is Temporarily Down For Scheduled MaintenanceMark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay
40454084045408
  • Invalid merchant, status is not active
  • Invalid Field Format
Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter or Contact Shopeepay to check merchant/store status
40454134045413Invalid Amount. Currency Does Not Support CentsMark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40454184045418Inconsistent RequestMark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter
40954004095400ConflictMark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay
50054005005400General ErrorMark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay
50054015005401Internal Server ErrorMark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay
50454005045400TimeoutMark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay

Check Transaction Status for Link&Pay

Note:

  • While a 200xx00 response generally indicates a successful API call, the actual transaction might still be processing in the background. To confirm the latest status of your transaction, we strongly recommend referring to the latestTransctionStatus field in the API response. This will provide the most up-to-date information.

Specification

The following table is the specification of the API:

HTTP MethodPOST
Service Code55
Path.../v1.0/debit/status
Versionv1.0

Request Parameter

FieldTypeMandatoryDescription
originalPartnerReferenceNoStringMUnique identifier of the transaction merchant would like to query, which could be partnerReferenceNo or partnerRefundNo.
merchantIdStringMUnique identifier of merchant in merchant system.
externalStoreIdStringMUnique identifier of store in merchant system.
serviceCodeStringMService code of original transaction, which could be 54 (Link and Pay transaction) or 58 (refund).
amountObjectM
  • value
StringMTransaction amount
  • Sample: 10.000,00 will be placed with 10000.00
  • currency
StringMCurrency that is associated with the refund amount
  • Accepted values: IDR

Sample API Request

RESPONSE

{
"originalPartnerReferenceNo": "Testing-123",
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"serviceCode": "54",
"amount": {
"value": "10000.00",
"currency": "IDR"
}
}
arrow-svg

Copy

Response Parameter

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned
responseMessageStringMDebug message to provide more information
originalReferenceNoStringCTransaction identifier in ShopeePay system that is shown to the customer.
  • The value will be returned for successful payment.
originalPartnerReferenceNoStringOUnique identifier of the transaction merchant would like to query, which could be partnerReferenceNo or partnerRefundNo.
serviceCodeStringMService code of original transaction, which could be 54 (Link and Pay transaction) or 58 (refund).
latestTransactionStatusStringM
transAmountObjectO
  • value
StringMTransaction amount.
  • Sample: 10.000,00 will be placed with 10000.00
  • currency
StringMRefers to the currency abbreviation for the transaction.
  • IDR
paidTimeStringCUpdate time of the individual transaction.
  • Using ISO-8601 timestamp format.
additionalInfoObjectO
  • createTime
StringOCreate time of the individual transaction.
  • Using ISO-8601 timestamp format.
  • productType
uint32OIndicates the payment method used.
  • transactionType
uint32ORefer to Transaction Types for specific transaction types
  • merchantId
StringOUnique identifier of merchant in merchant system.
  • externalStoreId
StringOUnique identifier of store in merchant system.
  • userIdHash
StringOUnique identifier of the user making the payment.
  • promoIdApplied
StringOComma separated eligible promoIds of 100 characters or less (up to 20), if any.
  • These promoIds will be checked against promotional campaigns configured in ShopeePay to determine the valid reward amount the customer can receive for this transaction.
  • paymentChannel
int32OIndicates the source of fund used.

Sample API Response

RESPONSE

{
"responseCode": "2005500",
"responseMessage": "Successful",
"original ReferenceNo": "Testing-123",
"originalPartnerReferenceNo": "Payment-123",
"serviceCode": "54",
"latestTransactionStatus": "00",
"paidTime": "2022-07-20T07:10:10+07:00",
"transAmount": {
"value": "10000.00",
"currency": "IDR"
},
"additionalInfo": {
"createTime": "2022-07-20T07:05:00+07:00",
"productType": 16,
"transactionType": 13,
"userIdHash": "15e455125fba426a4a2bb9145b3af2906813a7f222f6eab93b026ead62dc8d76",
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"promoIdApplied": "Promo1, Promo2",
"paymentChannel": 1
}
}
arrow-svg

Copy

Response Codes

Please refer to the following description for a general explanation of the responseCode returned during an API Response.

For a more detailed explanation, it is advisable to consult responseMessage. This field provides additional information that can offer valuable insights for troubleshooting.

Merchants may choose to display the responseMessage to their operators or staffs to facilitate prompt identification and resolution of the issue.

HTTP codeService CodeSub-error CodeResponse CodeResponse MessagePartner Action
20055002005500SuccessfulMark LnP (Link&Pay) payment to corresponding status according to response.additionalInfo.latestTransactionStatus. Retry request periodically if didn't get final status
40055004005500Bad RequestMark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40055014005501
  • Invalid field format {fieldName}
  • Invalid field format {serviceCode}
  • Invalid Field Format {metadata}. Exceed Maximum Characters
  • Invalid Field Format {metadata}. Maximum JSON Key Exceeded
  • Invalid Field Format {metadata}. Invalid JSON Key Name
  • Invalid Field Format {metadata}
  • Invalid mandatory field {value}, Non-Positive Amount
Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40055014005501Invalid Field FormatMark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40055024005502
  • Invalid mandatory field {fieldName}
  • Invalid mandatory field {partnerReferenceNo}
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid mandatory field {merchantId/externalStoreId}
  • Invalid Amount. Amount cannot contain cents
  • Invalid Mandatory Field + {error message}
Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40055084005508Invalid Field format Invalid MerchantMark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay
40155004015500Unauthorized invalid client key Unauthorized.{error message}Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40155014015501Invalid TokenMark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40355084035508
  • Invalid Merchant, Status Is Not Active
  • Invalid Store, Status Is Not Active
Mark LnP (Link&Pay) payment to Pending. Contact Shopeepay to check merchant/store status
40455014045501Transaction not foundMark LnP (Link&Pay) payment to Failed
40455084045508Entity not foundMark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay
40455134045513
  • Invalid amount. Mismatch with original transaction
  • Invalid Amount. Non Positive Amount Is Not Allowed
Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter
40955004095500ConflictMark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay
50055005005500General ErrorMark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay
50055015005501Internal Server ErrorMark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay
50455005045500TimeoutMark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay

Refund Payment

Use this endpoint to request a refund for a successful transaction. Refunds are subject to refund conditions.

HTTP MethodPOST
Service Code58
Path../v1.0/debit/refund
Versionv1.0

Refer to Refund Payment for the detail request and response parameters.

Notify Transaction Status

Note: Merchant needs to confirm that both the payment amount and the originalPartnerReferenceNo correspond to the original /debit/payment-host-to-host request before considering the payment successful.

HTTP MethodPOST
Service Code56
Path.../v1.0/debit/notify
Versionv1.0

Refer to Notify Transaction Status endpoint for the detail request body and response parameters.