Subscription
Merchant Workflow
To accept the payment in this scenario, the merchant needs to complete the following steps:
- Completed account linking request and store returned access token
- Initiate a payment request for Subscription when payment is due
The following figure illustrates the workflow of accepting a payment in the Subscription payment scenario:
- Merchant calls Create Payment Order: Subscription endpoint to charge from the customer’s ShopeePay account.
- ShopeePay will conduct a sequential attempt with each of the customer’s linked payment methods with ShopeePay, until the transaction is successful.
- ShopeePay will sends an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
- Merchant can also call the Check Transaction Status endpoint to query the status of the transaction.
- If the response code is "Success" and the
latestTransactionStatus
is00
, merchant can mark this transaction as successful. - If the response code = "Failed", the 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
Create Payment Order: Subscription
- Use this endpoint to create a direct payment with an access token.
- 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.0.2/debit/payment-host-to-host |
Version | v1.0.2 |
Request Parameters
Field | Type | Mandatory | Description |
---|---|---|---|
partnerReferenceNo | String | M | Unique identifier of payment transaction generated by merchant. |
merchantId | String | M | Unique identifier of merchant in merchant system.
|
externalStoreId | String | M | Unique identifier of store in merchant system.
|
amount | Object | M | |
| String | M | Transaction amount.
|
| String | M | Currency that is associated with the payment amount.
|
urlParams | Array of Object | M | Array of object |
| String | M | Indicates the URL of the merchant's platform to return back to, once the payment on ShopeePay’s page is completed. |
| String | M | Indicates the type of the sent url.
|
| String | M | Indicates whether the url is a deep link or not.
|
additionalInfo | Object | O | |
| String | M | The accountToken used to represent the account binding between Merchant's platform and ShopeePay. |
| Boolean | O | Use 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.
|
| String | O | Comma separated eligible promoIds of 100 characters or less (up to 20), if any.
|
| String | O | Additional information for the transaction. Additional information for the transaction.
|
Sample API Request
REQUEST
"partnerReferenceNo": "Direct Payment-123","merchantId": "Merchant123","externalStoreId": "Store123","amount": {"value": "10000.00","currency": "IDR"},"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\"}"}}
Copy
Response Parameter
Field | Type | Mandatory | Description |
---|---|---|---|
responseCode | String | M | Error code to specify the error returned |
responseMessage | String | M | Debug message to provide more information |
partnerReferenceNo | String | O | Unique identifier of payment transaction generated by merchant |
ReferenceNo | String | C | Transaction Identifier in ShopeePay System |
additionalInfo | Object | O | |
| String | O | Transaction amount.
|
| String | O | Unique identifier of merchant in merchant system |
| String | O | Unique identifier of store in merchant system |
| String | O | Create time of the individual transaction. |
| String | O | Update time of the individual transaction. |
| String | O |
|
| uint32 | O | 13, referring to subscription transaction type. Refer to Transaction Types for specific transaction types |
| String | O | Identifier for customer that made the payment. |
| String | O | Comma separated eligible promoIds of 100 characters or less (up to 20), if any. |
| int32 | O | Indicates the source of fund used.
|
Sample API Response
JS EXAMPLE
{"responseCode": "2005400","responseMessage": "Successful","partnerReferenceNo": "Direct Payment-123","referenceNo": "Shopee Pay-Direct Payment-123","additionalInfo": {"value": "10000.00","merchantId": "Merchant123","externalStoreId": "Store123","createTime": "2022-07-20T07:00:00+07:00","updateTime": "2022-07-20T07:00:01+07:00","transactionType": 13,"userIdHash": "15e455125fba426a4a2bb9145b3af2906813a7f222f6eab93b026ead62dc8d76","latestTransactionStatus": "00","promoIdApplied": "Promo1, Promo2","paymentChannel": 1}}
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 code | Service Code | Sub-error Code | Response Code | Response Message | Partner Action |
---|---|---|---|---|---|
200 | 54 | 00 | 2005400 | Successful | Mark Subscription process to Success. Forward customer to Shopeepay page |
400 | 54 | 00 | 4005400 | Bad Request | Mark Subscription process to Failed. Retry request with proper parameter |
400 | 54 | 01 | 4005401 |
| Mark Subscription process to Failed. Retry request with proper parameter |
400 | 54 | 02 | 4005402 |
| Mark Subscription process to Failed. Retry request with proper parameter |
401 | 54 | 00 | 4015400 |
| Mark Subscription process to Failed. Retry request with proper parameter |
401 | 54 | 01 | 4015401 | Invalid Token | Mark Subscription process to Failed. Retry request with proper parameter |
403 | 54 | 01 | 4035401 |
| Mark Subscription 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 Subscription process to Failed. Retry request periodically or consult to Shopeepay |
404 | 54 | 08 | 4045408 |
| Mark Subscription 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 Subscription process to Failed. Retry request with proper parameter |
404 | 54 | 18 | 4045418 | Inconsistent Request | Mark Subscription process to Failed. Retry request with proper parameter |
409 | 54 | 00 | 4095400 | Conflict | Mark Subscription process to Failed. Retry request periodically or consult to Shopeepay |
500 | 54 | 00 | 5005400 | General Error | Mark Subscription process to Failed. Retry request periodically or consult to Shopeepay |
500 | 54 | 01 | 5005401 | Internal Server Error | Mark Subscription process to Failed. Retry request periodically or consult to Shopeepay |
504 | 54 | 00 | 5045400 | Timeout | Mark Subscription process to Failed. Retry request periodically or consult to Shopeepay |
Check Transaction Status for Subscription
- Use this endpoint to query the status of Subscription transaction
- All API requests require a header. Refer to API Param Specification → Transaction Request
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 Method | POST |
---|---|
Service Code | 55 |
Path | .../v1.0/debit/status |
Version | v1.0 |
Request Parameter
Field | Type | Mandatory | Description |
---|---|---|---|
originalPartnerReferenceNo | String | M | Unique identifier of the transaction merchant would like to query, which could be partnerReferenceNo or partnerRefundNo. |
merchantId | String | M | Unique identifier of merchant in merchant system. |
externalStoreId | String | M | Unique identifier of store in merchant system. |
serviceCode | String | M | Service code of original transaction, which could be 54 (Subscription) or 58 (refund). |
amount | Object | M | |
| String | M | Transaction amount
|
| String | M | Currency that is associated with the refund amount
|
Sample API Request
RESPONSE
{"originalPartnerReferenceNo": "Testing-123","merchantId": "Merchant123","externalStoreId": "Store123","serviceCode": "54","amount": {"value": "10000.00","currency": "IDR"}}
Copy
Response Parameter
Field | Type | Mandatory | Description |
---|---|---|---|
responseCode | String | M | Error code to specify the error returned |
responseMessage | String | M | Debug message to provide more information |
originalReferenceNo | String | C | Transaction identifier in ShopeePay system that is shown to the customer.
|
originalPartnerReferenceNo | String | O | Unique identifier of the transaction merchant would like to query, which could be partnerReferenceNo or partnerRefundNo. |
serviceCode | String | M | Service code of original transaction, which could be 54 (create subscription transaction) or 58 (refund). |
latestTransactionStatus | String | M |
|
transAmount | Object | O | |
| C | Transaction amount.
| |
| C | Refers to the currency abbreviation for the transaction.
| |
paidTime | String | M | Update time of the individual transaction.
|
additionalInfo | Object | O | |
| String | O | Create time of the individual transaction.
|
| uint32 | O | Indicates the payment method used.
|
| uint32 | O | Refer to Transaction Types for specific transaction types |
| String | O | Unique identifier of merchant in merchant system. |
| String | O | Unique identifier of store in merchant system. |
| String | O | Unique identifier of the user making the payment. |
| String | O | Comma separated eligible promoIds of 100 characters or less (up to 20), if any.
|
| int32 | O | Indicates 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}}
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 code | Service Code | Sub-error Code | Response Code | Response Message | Partner Action |
---|---|---|---|---|---|
200 | 55 | 00 | 2005500 | Successful | Mark Subscription 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 Subscription payment to Pending. Retry request with proper parameter |
400 | 55 | 01 | 4005501 |
| Mark Subscription payment to Pending. Retry request with proper parameter |
400 | 55 | 01 | 4005501 | Invalid Field Format | Mark Subscription payment to Pending. Retry request with proper parameter |
400 | 55 | 02 | 4005502 |
| Mark Subscription payment to Pending. Retry request with proper parameter |
400 | 55 | 08 | 4005508 | Invalid Field format Invalid Merchant | Mark Subscription payment to Pending. Retry request periodically or consult to Shopeepay |
401 | 55 | 00 | 4015500 | Unauthorized invalid client key Unauthorized.{error message} | Mark Subscription payment to Pending. Retry request with proper parameter |
401 | 55 | 01 | 4015501 | Invalid Token | Mark Subscription payment to Pending. Retry request with proper parameter |
403 | 55 | 08 | 4035508 |
| Mark Subscription payment to Pending. Contact Shopeepay to check merchant/store status |
404 | 55 | 01 | 4045501 | Transaction not found | Mark Subscription payment to Failed |
404 | 55 | 08 | 4045508 | Entity not found | Mark Subscription payment to Pending. Retry request periodically or consult to Shopeepay |
404 | 55 | 13 | 4045513 |
| Mark Subscription payment to Pending. Retry request with proper parameter |
409 | 55 | 00 | 4095500 | Conflict | Mark Subscription payment to Pending. Retry request periodically or consult to Shopeepay |
500 | 55 | 00 | 5005500 | General Error | Mark Subscription payment to Pending. Retry request periodically or consult to Shopeepay |
500 | 55 | 01 | 5005501 | Internal Server Error | Mark Subscription payment to Pending. Retry request periodically or consult to Shopeepay |
504 | 55 | 00 | 5045500 | Timeout | Mark Subscription 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 | 52 |
Path | .../v1.0/debit/notify |
Version | v1.0 |
Refer to Notify Transaction Status endpoint for the detail request body and response parameters.