Link & Pay
Merchant Workflow
To initiate the payment in this scenario, the merchant needs to complete the following steps:
- Completed account linking request and store returned account token
- Optional: to retrieve user information or coin redemption using account token
- 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:
- 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.
- 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.
- Customer selects a payment method and confirms payment.
- ShopeePay processes the payment and returns the customer back to the merchant's page.
- ShopeePay will sends an asynchronous message via Notify Payment Status endpoint to inform merchants on the payment result.
- Merchants must call the Check Transaction Status endpoint to query the status of the transaction.
- If the Response Code is "Success" and the
latestTransactionStatusis00, 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.
- If the Response Code is "Success" and the
- 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.
Get Payment Methods
Mandatory when the merchant maintains their own end-to-end checkout flow (API-Based flow).
Use this endpoint to retrieve the user's linked payment methods for the transaction. The merchant should display each payment method returned by the API, along with its associated information, on the merchant's frontend for the user to select.
| HTTP Method | POST |
|---|---|
| Service Code | 11 |
| Path | .../v2.0/balance-inquiry |
| Version | v2.0 |
Request Parameters
Response Parameters
Error code to specify the error returned.
Debug message to provide more information from response code.
Additional fields in "paymentPromoInfo" depending on promoType
| promoType | Additional Field(s) | Type | Description | Example |
|---|---|---|---|---|
| DISCOUNT | savingsAmount | string | The amount reduced from original payment | 1000.00 |
| COIN_REDEMPTION | savingsAmount | string | The amount reduced from original payment | 1000.00 |
| FEE_WAIVER | feeAmountAfterWaived | string | The fee value after the waiver is applied | 1000.00 |
Response Code
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 code | Service Code | Sub-error Code | Response Code | Response Message | Partner Action |
|---|---|---|---|---|---|
| 200 | 11 | 00 | 2001100 | Successful | Resume the next action, such as Payment Request |
| 400 | 11 | 01 | 4001101 | No Eligible Channel | Retry the request or create new request |
| 400 | 11 | 01 | 4001101 | Payment Limit Hit | Fail the request and retry with different payment amount |
| 400 | 11 | 01 | 4001101 | Invalid Access Token Length | Fail the request and retry with the proper value |
| 400 | 11 | 02 | 4001102 |
| Fail the request and retry with the proper value |
| 400 | 11 | 02 | 4001102 |
| Fail the request and Contact Shopeepay to check merchant/store status |
| 401 | 11 | 00 | 4011100 | Unauthorized. Invalid Token | User's token status should be active (Invalid / Inactive) |
| 401 | 11 | 00 | 4011100 | Unauthorized. Account token in API header does not match in API body | Fail the request and retry with the proper value |
| 401 | 11 | 01 | 4011101 | Invalid B2B Token | Fail the request and retry with the proper value |
| 401 | 11 | 02 | 4011102 | Unauthorized. Account Token is not valid for this merchant | Fail the request and retry with the proper value |
| 403 | 11 | 01 | 4031101 | Feature Not Allowed | Fail the request and Contact Shopeepay to check the merchant's configuration |
| 403 | 11 | 05 | 4031105 |
| Fail the request |
| 403 | 11 | 05 | 4031105 | Invalid Field Format {mobileNumber}. User Is Not Found | Fail the request and retry with the proper value |
| 403 | 11 | 05 | 4031105 | Permission Denied | Fail the request and Contact Shopeepay to check merchant/store status |
| 404 | 11 | 11 | 4041111 |
| Fail the request and retry with the proper value |
| 404 | 11 | 13 | 4041113 | Invalid Amount. Currency Does Not Support Cents | Fail the request and retry with the proper value |
| 500 | 11 | 01 | 5001101 |
| Fail the request and retry with the proper value |
| 504 | 11 | 00 | 5041100 | Timeout | Create new request |
Create Payment Order: Link & Pay
- Use this endpoint to create a payment with an access token and a hosted-checkout page
- All API requests require a header. Refer to API Param Specification → Transaction Request
Specification
The following table is the specification of the API:
| HTTP Method | POST |
| Service Code | 54 |
| Path | .../v1.1/debit/payment-host-to-host |
| Version | v1.1 |
Request Parameter
Unique identifier of payment transaction generated by merchant.
Unique identifier of merchant in merchant system.
- Accepts up to 64 characters.
Unique identifier of store in merchant system.
- Accepts up to 64 characters.
- Accepts up to 1,800 seconds (30 mins), from the time request was received
- If this field is filled,
partnerReferenceNoin this request will expire after the specified time period (in seconds) and payment attempt to thispartnerReferenceNowill fail. - Using ISO 8601 timestamp format.
Array of object.
Object containing the details of the selected payment method for the transaction.
Response Parameters (When Payment Verification is Required)
Error code to specify the error returned.
Debug message to provide more information from response code.
Order identifier in ShopeePay system.
The URL for the Client's front-end to redirect to for PIN / OTP verification / SPayLater Agreement page. Only applicable if additional verification / user's acknowledgement is needed.
Note: After the user completes payment verification on the ShopeePay webpage, they will be redirected to your specified return_url. If the payment fails, a fail_reason query parameter will be appended to the return_url to indicate the reason for the failure.
Possible values for fail_reason is outlined on the table below:
| fail_reason | Definition |
|---|---|
ERROR_INTERNAL_ERROR | Payment Failed with unknown error / ShopeePay internal timeout |
DECLINED_VERIFICATION_FAILED | The payment authentication was not executed, or it did not execute successfully |
DECLINED_INSUFFICIENT_BALANCE | Wallet balance, or Credit balance or Bank Account is insufficient |
DECLINED_SUSPICIOUS | Payment failed due to a suspicious payment transaction |
DECLINED_LIMIT_EXCEEDED | Payment amount Limit is exceeded |
Response Parameters (When Payment Verification is Not Required)
Error code to specify the error returned.
Debug message to provide more information from response code.
Unique identifier of payment transaction generated by Client.
Order identifier in ShopeePay system.
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 code | Service Code | Sub-error Code | Response Code | Response Message | Partner Action |
|---|---|---|---|---|---|
| 200 | 54 | 00 | 2005400 | Successful | Mark LnP (Link&Pay) generate process to Success. Forward customer to Shopeepay page |
| 400 | 54 | 00 | 4005400 | Bad Request | Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 400 | 54 | 01 | 4005401 |
| Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 400 | 54 | 02 | 4005402 |
| Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 401 | 54 | 00 | 4015400 |
| Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 401 | 54 | 01 | 4015401 | Invalid Token | Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 403 | 54 | 01 | 4035401 |
| Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay |
| 403 | 54 | 06 | 4035406 | Feature Not Allowed. Service Is Temporarily Down For Scheduled Maintenance | Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay |
| 404 | 54 | 08 | 4045408 |
| Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter or Contact Shopeepay to check merchant/store status |
| 404 | 54 | 13 | 4045413 | Invalid Amount. Currency Does Not Support Cents | Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 404 | 54 | 18 | 4045418 | Inconsistent Request | Mark LnP (Link&Pay) generate process to Failed. Retry request with proper parameter |
| 409 | 54 | 00 | 4095400 | Conflict | Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay |
| 500 | 54 | 00 | 5005400 | General Error | Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay |
| 500 | 54 | 01 | 5005401 | Internal Server Error | Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay |
| 504 | 54 | 00 | 5045400 | Timeout | Mark LnP (Link&Pay) generate process to Failed. Retry request periodically or consult to Shopeepay |
Check Transaction Status for Link&Pay
- Use this endpoint to query the status of a Link&Pay transaction
- All API requests require a header. Refer to API Param Specification → Transaction Request
Note:
- While a
200xx00response 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 Method | POST |
| Service Code | 55 |
| Path | .../v1.0/debit/status |
| Version | v1.0 |
Request Parameter
Unique identifier of the transaction merchant would like to query, which could be partnerReferenceNo or partnerRefundNo.
Unique identifier of merchant in merchant system.
Unique identifier of store in merchant system.
Service code of original transaction, which could be 54 (Link and Pay transaction) or 58 (refund).
Response Parameter
Error code to specify the error returned.
Debug message to provide more information.
Transaction identifier in ShopeePay system that is shown to the customer.
The value will be returned for successful payment.
Unique identifier of the transaction merchant would like to query, which could be partnerReferenceNo or partnerRefundNo.
Service code of original transaction, which could be 54 (Link and Pay transaction) or 58 (refund).
Refer to Transaction Status for specific transaction statuses.
Update time of the individual transaction.
Using ISO-8601 timestamp format.
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 code | Service Code | Sub-error Code | Response Code | Response Message | Partner Action |
|---|---|---|---|---|---|
| 200 | 55 | 00 | 2005500 | Successful | Mark LnP (Link&Pay) payment to corresponding status according to response.additionalInfo.latestTransactionStatus. Retry request periodically if didn't get final status |
| 400 | 55 | 00 | 4005500 | Bad Request | Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 400 | 55 | 01 | 4005501 |
| Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 400 | 55 | 01 | 4005501 | Invalid Field Format | Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 400 | 55 | 02 | 4005502 |
| Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 400 | 55 | 08 | 4005508 | Invalid Field format Invalid Merchant | Mark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay |
| 401 | 55 | 00 | 4015500 | Unauthorized invalid client key Unauthorized.{error message} | Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 401 | 55 | 01 | 4015501 | Invalid Token | Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 403 | 55 | 08 | 4035508 |
| Mark LnP (Link&Pay) payment to Pending. Contact Shopeepay to check merchant/store status |
| 404 | 55 | 01 | 4045501 | Transaction not found | Mark LnP (Link&Pay) payment to Failed |
| 404 | 55 | 08 | 4045508 | Entity not found | Mark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay |
| 404 | 55 | 13 | 4045513 |
| Mark LnP (Link&Pay) payment to Pending. Retry request with proper parameter |
| 409 | 55 | 00 | 4095500 | Conflict | Mark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay |
| 500 | 55 | 00 | 5005500 | General Error | Mark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay |
| 500 | 55 | 01 | 5005501 | Internal Server Error | Mark LnP (Link&Pay) payment to Pending. Retry request periodically or consult to Shopeepay |
| 504 | 55 | 00 | 5045500 | Timeout | Mark 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 Method | POST |
| Service Code | 58 |
| Path | ../v1.0/debit/refund |
| Version | v1.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 Method | POST |
| Service Code | 56 |
| Path | .../v1.0/debit/notify |
| Version | v1.0 |
Refer to Notify Transaction Status endpoint for the detail request body and Response Parameters.