Checkout With ShopeePay

Merchant Workflow

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

  1. Initiate a payment request when customer selects to pay

  2. Handle the redirect URL returned

  3. Handle notification callback or query to check payment results

The following figure illustrates the workflow of accepting a payment in the Checkout with ShopeePay payment scenario:

  1. Customer selects goods or services and proceeds to check out from the merchant's application or website using ShopeePay. Merchant sends payment request to ShopeePay server via the Create Checkout Order endpoint. ShopeePay returns redirectUrl and this URL can be used to direct users to Shopee/ShopeePay application or website.
  2. Customer is redirected to either Shopee/ShopeePay application or website to proceed with payment.
  3. Customer sees the payment details such as payment amount, supported payment methods, and relevant promotional information on the Shopee/ShopeePay application or website.
  4. ShopeePay system returns the transaction result to the merchant. Meanwhile, customers will also see the updated payment result on the Shopee/ShopeePay application or website. ShopeePay also sends an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
  5. Customer is then redirected back to the merchant's page to view payment status, as specified by the merchant in the urlParam.url of the Create Checkout Order endpoint. 
    • Note: Redirection to urlParams.url should never be used as an indication of payment success. The Merchant should only rely on the server request response to check the final status of payment.
  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 until payment expires. Alternatively, merchants can call the Invalidate endpoint to terminate the transaction.
    • 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 until the payment expires.

Create Checkout Order

Specification

The following table is a specification of this API:

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

Request Parameters

FieldTypeMandatoryDescription
partnerReferenceNoStringMUnique identifier for request.
  • 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 transaction amount.
  • Accepted values: IDR
merchantIdStringMUnique identifier of merchant in merchant’s system.
  • Accepts up to 64 characters.
externalStoreIdStringMUnique identifier of store in merchant’s system.
  • Accepts up to 64 characters.
urlParamsArray of ObjectM
  • url
StringMIndicates the URL (in HTTP links or URL scheme formats) of the merchant’s application to redirect back to once the payment is processed by ShopeePay or when the customer canceled the payment.
  • 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.
validUpToStringO
  • By default, the expiry time will be set to 1200 seconds (20 minutes), from the time the request was received.
    • Accepts up to 432,000 seconds (5 days), 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.
pointOfInitiationStringMType of the merchant's platform that the customer triggered the checkout flow from.
  • Accepted values:
    • "app"
    • "pc"
    • "mweb" (mobile web)
additionalInfoObjectO
  • 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.
  • phone
StringORegistered phone number of the customer on merchant's platform, to be provided with the country code and without the plus sign.
  • Example:
    • An Indonesian phone number "82112345678" should be passed in as "6282112345678", with 62 being the country code.
  • metadata
StringOAdditional 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}\”}
  • preferredPaymentMethodType
StringO

Allow merchants to set a preferred payment method for the payment order, which will be pre-selected on the customer's payment page.

  • Customer will still have the option to view and choose from other available payment methods
  • Accepted value:
    • SPayLater = 'spay_later'

Sample API Request

REQUEST

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

Copy

Respond Parameter

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
referenceNoStringC
  • Transaction identifier in ShopeePay system. Will be filled upon successful transaction.
webRedirectUrlStringMIndicates the universal URL to ShopeePay's payment 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

RESPONSE

{
"responseCode": "2005400",
"responseMessage": "Successful",
"referenceNo": "169940762961566068",
"webRedirectUrl": "https://id.uat.shp.ee/shopeepay_checkout_id?type=start&mid=10202124&medium_index=dFhkbmR1bTBIamhW5ALIHEvw_6Ka2b4jCx031mB9F0VbIxfnE82M_1KXVjVfK5wpa-p2pQ& order_key=zPQK1kiWWbAD14jtiLE4hB71j3NTZIlr_RqewrLbDVrwBexbwrVmhdgFYCrkFP3IRkrt4-3hg0loMg&order_sn=169940762961566068&return_url=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8%2FYW1vdW50PTE3MDAwJmNsaWVudF9pZD1PcGVuKOFQSStUZXN0aW5nKOFjY291bnQILSs1JnJlZmVyZW5jZV9pZD1GMDNCNTJmNzEXNEU5R2ZmMEM3Rkc00TQmcmVzdWx0X2NvZGU9MjAz JnNpZ25hdHVyZT1LWF9sa3NBOTJRm5qNmlvY1h4bVNTQ1daMEdPam5DRVRWCXNTYmJKWkt3JTNE&source=web&token=dFhkbmR1bTBIamhW5ALIHEvw_6Ka2b4jCx031mB9F0VbIxfnE82M_1KXVjVfK5wpa-p2pQ"
}
arrow-svg

Copy

Respond 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 codeService CodeSub-error CodeResponse CodeResponse MessagePartner Action
20054002005400SuccessfulMark CWS(Checkout With Shopeepay) generate process to Success. Forward customer to Shopeepay page
40054004005400Bad RequestMark CWS 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 CWS 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 CWS generate process to Failed. Retry request with proper parameter
40154004015400
  • Unauthorized. Invalid Client Key
  • Unauthorized.{error message}
Mark CWS generate process to Failed. Retry request with proper parameter
40154014015401Invalid TokenMark CWS generate process to Failed. Retry request with proper parameter
40354014035401
  • Feature Not Allowed
  • Feature Not Allowed. Selected Payment Channel Is Disabled For Merchant
Mark CWS generate process to Failed. Retry request periodically or consult to Shopeepay
40354064035406Feature Not Allowed. Service Is Temporarily Down For Scheduled MaintenanceMark CWS generate process to Failed. Retry request periodically or consult to Shopeepay
40454084045408
  • Invalid merchant, status is not active
  • Invalid Field Format
Mark CWS generate process to Failed. Retry request with proper parameter or Contact Shopeepay to check merchant/store status
40454134045413Invalid Amount. Currency Does Not Support CentsMark CWS generate process to Failed. Retry request with proper parameter
40454184045418Inconsistent RequestMark CWS generate process to Failed. Retry request with proper parameter
40954004095400ConflictMark CWS generate process to Failed. Retry request periodically or consult to Shopeepay
50054005005400General ErrorMark CWS generate process to Failed. Retry request periodically or consult to Shopeepay
50054015005401Internal Server ErrorMark CWS generate process to Failed. Retry request periodically or consult to Shopeepay
50454005045400TimeoutMark CWS generate process to Failed. Retry request periodically or consult to Shopeepay

Invalidate Order

  • Use this endpoint to invalidate the existing order using payment reference id for Checkout with ShopeePay if the order in the merchant’s system is closed/cancelled. Once the order payment reference id is invalidated successfully, the corresponding webRedirectUrl can no longer be used to make payment.
  • All API requests require a header. Refer to API Param Specification → Transaction Request

Specification

The following table is the specification of the API:

HTTP MethodPOST
Service Code57
Path.../v1.0/debit/cancel
Versionv1.0

Request Parameter

FieldTypeMandatoryDescription
originalPartnerReferenceNoStringMUnique identifier of the transaction that the merchant intends to invalidate or cancel.
merchantIdStringMUnique identifier of merchant in merchant system.
  • Accept up to 64 characters.
externalStoreIdStringMUnique identifier of store in merchant system.
  • Accept up to 64 characters.

Sample API Request

REQUEST

{
"originalPartnerReferenceNo": "Testing-123",
"merchantId": "Merchant123",
"externalStoreId": "Store123"
}
arrow-svg

Copy

Response Parameter

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
cancelTimeStringCUpdate time of the individual transaction.
  • The value will be returned for successful invalidate request.
  • Using ISO-8601 timestamp format.
originalReferenceNoStringCTransaction identifier in ShopeePay system that is shown to the customer. The value will be returned for successful payment.

Sample API Response

RESPONSE

{
"responseCode": "2005700",
"responseMessage": "Successful",
"cancelTime": "2024-07-03T16:41:41+07:00",
"originalReferenceNo": "123323887564698876"
}
arrow-svg

Copy

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 codeService CodeSub-error CodeResponse CodeResponse MessagePartner Action
20057002005700SuccessfulMark CWS(Checkout With Shopeepay) cancel process to Success. Mark CWS payment to Failed
40057004005700Bad RequestMark CWS cancel process to Failed. Retry request with proper parameter
40057014005701Invalid Field FormatMark CWS cancel process to Failed. Retry request with proper parameter
40057024005702
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid mandatory field {originalPartnerReferenceNo}
  • Invalid mandatory field {externalStoreId}
  • Invalid Mandatory Field + {error message}
Mark CWS cancel process to Failed. Retry request with proper parameter
40157004015700
  • Unauthorized. Invalid Client Key
  • Unauthorized.{error message}
Mark CWS cancel process to Failed. Retry request with proper parameter
40157014015701Invalid TokenMark CWS cancel process to Failed. Retry request with proper parameter
40357014035701Feature Not AllowedMark CWS cancel process to Failed. Contact Shopeepay to check merchant/store supported product flow
40357154035715
  • Transaction Not Permitted. Transaction Already In Final State
  • Transaction Not Permitted. Merchant Info Mismatch
  • Transaction Not Permitted. Order Is Already Expired
Mark CWS cancel process to Failed. Retry request with proper parameter or retry request "Check Debit Status" to get final status
40457014045701Transaction Not FoundMark CWS cancel process to Failed. Retry request with proper parameter
40457084045708
  • Invalid Merchant
  • Invalid Store
  • Invalid fieldName
Mark CWS cancel process to Failed. Contact Shopeepay to check merchant/store status
40957004095700ConflictMark CWS cancel process to Failed. Retry request periodically or consult to Shopeepay
50057005005700General ErrorMark CWS cancel process to Failed. Retry request periodically or consult to Shopeepay
50057015005701Internal Server ErrorMark CWS cancel process to Failed. Retry request periodically or consult to Shopeepay
50457005045700TimeoutMark CWS cancel process to Failed. Retry request periodically or consult to Shopeepay

Check Checkout Transaction Status

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

REQUEST

{
"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 (create CwS 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
paidTimeStringMUpdate 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
uint32O
  • 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 CWS payment to corresponding status according to response.additionalInfo.latestTransactionStatus. Retry request periodically if didn't get final status
40055004005500Bad RequestMark CWS 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 CWS 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 CWS payment to Pending. Retry request with proper parameter
40055084005508
  • Invalid Field format
  • Invalid Merchant
Mark CWS payment to Pending. Retry request periodically or consult to Shopeepay
40155004015500
  • Unauthorized invalid client key
  • Unauthorized.{error message}
Mark CWS payment to Pending. Retry request with proper parameter
40155014015501Invalid TokenMark CWS payment to Pending. Retry request with proper parameter
40355084035508
  • Invalid Merchant, Status Is Not Active
  • Invalid Store, Status Is Not Active
Mark CWS payment to Pending. Contact Shopeepay to check merchant/store status
40455014045501Transaction not foundMark CWS payment to Failed
40455084045508Entity not foundMark CWS 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 CWS payment to Pending. Retry request with proper parameter
40955004095500ConflictMark CWS payment to Pending. Retry request periodically or consult to Shopeepay
50055005005500General ErrorMark CWS payment to Pending. Retry request periodically or consult to Shopeepay
50055015005501Internal Server ErrorMark CWS payment to Pending. Retry request periodically or consult to Shopeepay
50455005045500TimeoutMark CWS 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 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.