Link & Pay
Merchant Workflow
To initiate the payment in this scenario, the merchant needs to complete the following steps:
Allow the user to complete account linking and store the returned access token
Optional: to retrieve coin redemption info, for displaying on the merchant checkout page
(If API-Based) Call Get Payment Methods API to retrieve the user's available payment methods for this transaction
Initiate a payment request with the Direct Payment API when the user pays
- Before initiating a payment request, the merchant can call the two endpoints below based on the use cases:
- Get Payment Methods: ShopeePay will return the user's available payment methods for a given transaction, for the merchant to display for user's selection.
- Get Coin Redemption: ShopeePay will return the user's Shopee Coin redemption rules and Coin amount, should the merchant wish to display this information.
- Merchant calls the Direct Payment endpoint to initiate the payment. ShopeePay will return a redirect_url for the merchant to redirect users to ShopeePay's FE should there be further payment confirmation or verification required. If the user has selected a certain payment method on the merchant's FE, merchant must inform ShopeePay of this in the request.
- For API-Based flow, if no confirmation or verification is required, ShopeePay will directly return the payment result in the Direct Payment API response. Refer to Sample API Response (When No Confirmation/Verification Needed) for this case.
- ShopeePay processes the payment and returns the user back to the merchant’s page.
- ShopeePay will send an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
- Merchants can also call the Check Transaction Status endpoint to query the status of the transaction.
- If the response code is "Success", 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 24 hours.
- 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 24 hours.
- If customer can show evidence of payment success on their payment app, merchant may choose to consider payment as successful and wait for reconciliation process on T+1 to settle discrepancies with ShopeePay, if any.
API Documentation
Get Payment Methods
Mandatory when the merchant maintains their own end-to-end checkout flow (API-Based flow).
Use this endpoint to fetch the user's available payment methods for the transaction. Once ShopeePay returns the information to the merchant, merchant should display each method alongside their necessary information on the merchant's FE page, for the user to select.
- URL: "/v4/merchant-host/payment-methods/get"
Request Parameters
request_id
stringRequiredaccess_token
stringRequiredmerchant_ext_id
stringRequiredstore_ext_id
stringRequiredamount
int64Note that the value of this parameter is inflated by 100. For example, if the currency is SGD and the amount is $12.34, set the value of this parameter to 1234. If the currency is VND and the amount is 123, set the value of this parameter to 12300.
language
stringPossible values:
- Indonesian :
id
- English:
en
- Malay:
ms
- Thai:
th
- Vietnamese:
vi
additional_info
object{"field1": { Data1 }, "field2": { Data2 }, "field3": { Data3 }}
.Depending on the merchant's model and use-cases, we may require more information to be provided via this parameter, such as the user's device information, so that SPayLater can be returned without restriction. Contact the ShopeePay team to learn more.
Sample API Request
REQUEST
{"request_id": "input-unique-request-id-here","merchant_ext_id": "external-merchant","store_ext_id":"external-store","access_token": "uXjWuhPGepS9tntoC8kTK5er6DlbUiGeSJDt53","amount": 1000000,"currency": "IDR"}
Copy
Response Parameters
request_id
stringRequiredrequest_id
value from the request.errcode
int32Requireddebug_msg
stringRequiredsaved_payment_methods
arrayRequiredpayment_method_type
stringRequireddisplay_name
stringRequiredThis will be returned in the language provided by the merchant in the API request when applicable.
description
stringicon_url
stringRequiredNote: For Credit / Debit Cards, the icon is the network's icon (e.g. Visa / Mastercard).
saved_payment_method_id
stringRequiredThis can be used when the merchant wants to save the user's linked methods on file and customized the default selection logic.
payment_option_reference
stringRequiredThis hashed value consists of transaction information like the payment method option (e.g. which specific cards that the user chose), transaction fees and payable amount.
payment_method_availability
objectRequiredis_available
booleanRequiredtrue
: the payment method is available and may become a successful payment.false
: The payment method is unavailable. Do not allow users to select this payment method.
unavailable_reason
stringThis can be displayed on the merchant's frontend as needed. If the payment method is available, this field will be hidden.
payment_method_details
objectRequiredewallet
objectewallet
if payment_method_type = ewallet
available_balance
intRequiredThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
card
objectcard
if payment_method_type = card
last_4digits
stringRequiredcard_type
stringRequiredcredit_card
debit_card
network
stringRequiredPossible values:
visa
mastercard
amex
jcb
discovery
giro_bank
objectgiro_bank
if payment_method_type = giro_bank
last_4digits
stringRequiredspay_later
objectspay_later
if payment_method_type = spay_later
credit_balance
intRequiredThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
compliance_notices
arraycontent
objectRequiredcontent_type
stringRequiredtext
: for plain textlink
: for text with hyperlink
text
stringRequiredbold
booleanurl
stringspaylater_options
arrayRequiredsaved_payment_method_id
stringRequiredpayment_option_reference
stringRequireddisplay_name
stringRequiredpayment_method_availability
objectRequiredis_available
booleanRequiredtrue
: the payment method is available and may become a successful payment.false
: The payment method is unavailable. Do not allow users to select this payment method.
unavailable_reason
stringThis can be displayed on the merchant's frontend as needed. If the payment method is available, this field will be hidden.
loan_tenure
intRequiredFor example, if it's a 6-month installment, this value is
6
.monthly_payment
intRequiredThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
payment_promo_info
objectThere can be one of more promotion applicable for a single transaction.
applicability
stringRequiredPossible values:
global
: The promotion is applicable to all payment methods.payment_method
: The promotion is specific to this payment method.
promo_type
stringRequiredpromo_text
stringRequiredsavings_amount
intThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
Conditional: This is returned when promo_type =
DISCOUNT
or COIN_REDEMPTION
.fee_amount_after_waived
intThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
Conditional: This is returned when promo_type =
FEE_WAIVER
.transaction_fee
intThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
This parameter is to inform users of any fees that might apply beyond the main order amount, which must be displayed on the merchant's frontend for user's awareness before selection.
Note: Merchant should NOT need to adjust the order amount during the Direct Payment API request. Transaction fees are calculated and applied automatically by our system.
payable_amount
intRequiredThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
payment_promo_info
objectThere can be one of more promotion applicable for a single transaction.
applicability
stringRequiredPossible values:
global
: The promotion is applicable to all payment methods.payment_method
: The promotion is specific to this payment method.
promo_type
stringRequiredpromo_text
stringRequiredsavings_amount
intThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
Conditional: This is returned when promo_type =
DISCOUNT
or COIN_REDEMPTION
.fee_amount_after_waived
intThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
Conditional: This is returned when promo_type =
FEE_WAIVER
.transaction_fee
intThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
This parameter is to inform users of any fees that might apply beyond the main order amount, which must be displayed on the merchant's frontend for user's awareness before selection.
Note: Merchant should NOT need to adjust the order amount during the Direct Payment API request. Transaction fees are calculated and applied automatically by our system.
payable_amount
intRequiredThis parameter is inflated by 100: the smallest value is 1, which represents 0.01, while for currencies that don't support cents, the smallest value is 100, which represents 1.
Sample API Response
REQUEST
{"request_id": "123","errcode": 0,"debug_msg": "success","saved_payment_methods": [{"payment_method_type": "ewallet","saved_payment_method_id": "1042e4cee8ebd77de","payment_option_reference": "9A2S3CdWkp8n6Q2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8","display_name": "ShopeePay Wallet","description": "Fast, secure, and widely accepted. Pay instantly using Wallet","icon_url": "https://proxy.uss.s3.test.shopee.io/api/v4/0018404/shopee_logo_test_bucket/static/images/Img_giro_acbank.png","payment_method_availability": {"is_available": true},"payment_method_details": {"ewallet": {"available_balance": "500000"}},"payment_promo_info": [{"applicability": "global","promo_type": "COINS_REDEMPTION","promo_text": "- Rp1000 from ShopeePay Coins redemption","savings_amount": "100000"},{"applicability": "payment_method","promo_type": "DISCOUNT","promo_text": "- Rp1000","savings_amount": "100000"},{"applicability": "payment_method","promo_type": "CASHBACK","promo_text": "+Rp1000 Bonus"},{"applicability": "payment_method","promo_type": "COINBACK","promo_text": "+100 Coins"}],"transaction_fee": "20000","payable_amount": "620000"},{"payment_method_type": "spay_later","display_name": "SPayLater","description": "Buy Now Pay Later with 0% interest","icon_url": "https://proxy.uss.s3.test.shopee.io/api/v4/0018404/shopee_logo_test_bucket/static/images/ic_paymentoption_wallet_v2.png","payment_method_details": {"spay_later": {"credit_balance": "300000000","compliance_notices": [{"content": [{"content_type": "text","text": "I agree to the SPayLater”,"bold": false},{"content_type": "link","text": "Loan agreement","url": "https://spl_tnc.com/loan_agreement,"bold": true}]},{"content": [{"content_type": "link","text": “Transaction Notice”,"url": "https://txnnotice.com/notice","bold": true}]}],}},"spaylater_options": [{"saved_payment_method_id": "1042e4cee8ebd77de","payment_option_reference": "9A7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoDkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD","display_name": "3-Month Installments","payment_method_availability": {"is_available": true},"loan_tenure": 3,"monthly_payment": 1600000,"payment_promo_info": [{"applicability": "global","promo_type": "COINS_REDEMPTION","promo_text": "- Rp1000 from ShopeePay Coins redemption","savings_amount": "700000"},{"applicability": "payment_method","promo_type": "INTEREST_WAIVER","promo_text": "0% Interest"}],"transaction_fee": "20000","payable_amount": "620000"},{"saved_payment_method_id": "3542e4cee8ebd672f","payment_option_reference": "4AsHL7OmCyQ2S3C9AsHL9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHn62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD7OmCyQ2S3CdWkp8n62GcXsqkq84ZoDdWkp8n62GcXsqk344DH2","display_name": "12-Month Installments","payment_method_availability": {"is_available": true},"loan_tenure": 12,"monthly_payment": 1200000,"payment_promo_info": [{"applicability": "global","promo_type": "COINS_REDEMPTION","promo_text": "- Rp1000 from ShopeePay Coins redemption","savings_amount": "100000"},{"applicability": "payment_method","promo_type": "INTEREST_WAIVER","promo_text": "0% Interest"}],"transaction_fee": "20000","payable_amount": "620000"}]},{"payment_method_type": "giro_bank","saved_payment_method_id": "1042e4cee8ebd77de","payment_option_reference": "9AsHL7OmCyQ2S3CdWkp8n62G9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq849AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoDcXsqkq84ZoD","display_name": "SeaBank","icon_url": "https://proxy.uss.s3.test.shopee.io/api/v4/0018404/shopee_logo_test_bucket/static/images/Img_giro_acbank.png","payment_method_availability": {"is_available": true},"payment_method_details": {"giro_bank": {"last_4digits": "5536"}},"payment_promo_info": [{"applicability": "global","promo_type": "COINS_REDEMPTION","promo_text": "- Rp1000 from ShopeePay Coins redemption","savings_amount": "100000"},{"applicability": "payment_method","promo_type": "FEE_WAIVER","promo_text": "Free Admin Fee","feeAmountAfterWaived": "100000"},{"applicability": "payment_method","promo_type": "REWARD","promo_text": "A Lucky Draw"}],"transaction_fee": "20000","payable_amount": "620000"},{"payment_method_type": "card","saved_payment_method_id": "1042e4cee8ebd77de","payment_option_reference": "9AsHL7OmCyQ284ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoD9AsHL7OmCyQ2S3CdWkp8n62GcXsqkq84ZoDkp8n62GcXsqkq84ZoD","display_name": "HSBC","icon_url": "https://proxy.uss.s3.test.shopee.io/api/v4/0018404/shopee_logo_test_bucket/static/images/Img_giro_acbank.png","payment_method_availability": {"is_available": false,"unavailable_reason": "The card has expired"},"payment_method_details": {"card": {"last_4digits": "5536","card_type": "credit_card","network": "visa"}},"transaction_fee": "20000","payable_amount": "620000"}]}
Copy
Direct Payment
Use this endpoint to create a payment with an access token. If the user has selected a certain payment method on the merchant's checkout page, the payment_method_type and the payment_option_reference should be provided as the user's choice of method.
- URL: "/v3/merchant-host/transaction/payment/direct"
Request Parameters
request_id
stringRequiredpayment_reference_id
stringRequired- Accepts up to 64 characters
merchant_ext_id
stringRequiredstore_ext_id
stringRequiredaccess_token
stringRequiredamount
int64Requiredcurrency
stringRequiredreturn_url
stringRequiredpayment_method_type
stringNote: This field is mandatory only for the Link & Pay (API-Based) product flow.
payment_option_reference
stringNote: This field is mandatory only for the Link & Pay (API-Based) product flow.
promo_ids
Objectpromo_ids
of 100 characters or less (up to 20), if any.additional_info
stringexpiry_time
uint32Sample API Request
REQUEST
{"request_id": "input-unique-request-id-here","payment_reference_id":"ref-must-be-unique","merchant_ext_id": "external-merchant","store_ext_id":"external-store","access_token": "uXjWuhPGepSOtntoC8kTK5er6DlbUiGeSJDt53","amount": 1000000,"currency": "IDR","use_coin": true,"return_url": "https://isv-domain.com","expiry_time": 1716193900}
Copy
Response Parameters (When Payment Verification is Required)
request_id
stringRequiredrequest_id
in the request.errcode
stringRequireddebug_msg
stringRequiredredirect_url
stringRequiredSample API Response (When Payment Verification is Required)
RESPONSE
{"request_id": "input-unique-request-id-here","errcode": 0,"debug_msg": "success","redirect_url": "https://uat.shopeepay.co.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"}
Copy
Response Parameters (When Payment Verification is Not Required)
request_id
stringRequirederrcode
int32Requireddebug_msg
stringRequiredtransaction
objectRequiredreference_id
stringRequiredamount
int64Requiredstatus
uint32Requiredtransaction_type
uint32Requiredtransaction_sn
stringRequiredcreate_time
uint32Requiredupdate_time
uint32Requireduser_id_hash
stringRequiredmerchant_ext_id
uint32Requiredstore_ext_id
stringRequiredpromo_id_applied
stringRequiredpayment_channel
uint32Requiredpayment_method_type
stringRequiredSample API Response (When Payment Verification is Not Required)
JS EXAMPLE
{"request_id": "input-unique-request-id-here","errcode": 0,"debug_msg": "success","transaction": {"reference_id": "input-payment-ref-id","amount": 1000000,"create_time": 1716193693,"update_time": 1716193693,"transaction_sn": "4737856404311306","status": 3,"transaction_type": 13,"merchant_ext_id": "external-merchant","store_ext_id": "external-store","user_id_hash": "697863f9295aeddcb3db598ecbc74c59a13335abf4d8c41b40e33b28a9d7d63c","payment_channel": 1,"payment_method_type": "ewallet"}}
Copy
Response Code
Value | Description |
---|---|
-2 | A server dropped the connection |
-1 | A server error occurred |
0 | Success |
1 | The request parameters is invalid or a mandatory parameter is empty |
2 | Permission denied, often due to invalid status |
4 | Not found, often due to merchant/store/user/transaction not found |
9 | Customer’s account is banned |
11 | Duplicated request |
14 | Customer’s account is deleted |
24 | Customer's account is frozen |
27 | Customer's account is not activated |
42 | Insufficient balance |
43 | Insufficient balance |
50 | The request parameters is invalid due to payload sent is not a valid JSON |
105 | Invalid auth code |
140 | Customer’s wallet limit is reached |
1001 | Customer is not allowed to make the transaction |
1100 | ShopeePay internal payment module error |
1101 | ShopeePay internal payment module error |
1102 | Customer’s SPL credit limit is reached |
1103 | Customer is required to link their bank account |
1104 | Ineligible payment channel |
1105 | Transaction failed due to unsuccessful authentication |
1106 | Duplicated payment |
1200 | ShopeePay internal payment module error |
1201 | ShopeePay internal payment module error |
1500 | ShopeePay internal payment module error |
1800 | ShopeePay internal payment module error |
1801 | ShopeePay internal payment module error |
1906 | Unable to process refund due to transaction has been failed |
1907 | Ineligible payment channel |
1908 | Service is temporarily down for scheduled maintenance |
300088 | Customer is required to complete verification |
300210 | ShopeePay scam warning error message |