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
- 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 = "Success", the 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 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.
Create Payment Order: Subscription
Use this endpoint to create a direct payment with an access token.
- URL: "/v3/merchant-host/transaction/payment/direct"
Request Parameters
request_id
stringRequiredUnique identifier of the API request.
access_token
stringRequiredThe access token that was obtained from ShopeePay via the Get Access Token API, representing the user's authorization.
merchant_ext_id
stringRequiredUnique identifier of the merchant in the merchant's system.
store_ext_id
stringRequiredUnique identifier of the store in the merchant's system.
amount
int64The order amount. If this parameter is provided, we will precheck the availability of each payment method using this amount.
Note 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.
Note 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
stringLanguage in which the linked payment methods are displayed. The default is English.
Possible values:
Possible values:
- Indonesian :
id - English:
en - Malay:
ms - Thai:
th - Vietnamese:
vi
additional_info
objectShow child child parameters
field1
StringAny Payment Remark for ShopeePay Clearing Order Report. This can be a customized value for reconciliation purpose.
field2
StringAny Payment Remark for ShopeePay Clearing Order Report. This can be a customized value for reconciliation purpose.
field3
StringAny Payment Remark for ShopeePay Clearing Order Report. This can be a customized value for reconciliation purpose.
device_info
ObjectShow child child parameters
device_id
StringMerchant's unique identifier for the user's device.
device_brand
StringBrand of the device, e.g. 'Apple', 'Samsung'.
device_model
StringModel of the device, e.g. 'iPhone 14', 'Galaxy S24'.
os_version
StringOperating system and version, for example: 'iOS 16', 'Android 14'.
iosudid
StringUnique device identifier for iOS devices.
imei
StringUnique identifier such as IMEI (for compatible devices).
verification_completion_method
StringVerification that happens within merchant app.
Potential enum:
Potential enum:
- none
- biometric
- pin
- password
- pattern
- other
device_first_login_at
StringEarliest timestamp when this device first logged in to the merchant app.
risk_tags
ObjectShow child child parameters
jailbroken
Booleantrue if jailbroken (iOS) or rooted (Android)enabled_emulator
Booleantrue if the app is running in an emulator environment (for example Genymotion).enabled_remote_control
Booleantrue if remote access / remote control tools (for example TeamViewer, scrcpy) are activemodified_gps
Booleantrue if GPS appears tampered or inconsistent (possible GPS modification). installed_fake_gps_app
Booleantrue if known fake-GPS apps are installed on the device.gps
ObjectShow child child parameters
latitude
FloatDevice latitude at the time of transaction.
longitude
FloatDevice longitude at the time of transaction.
location
StringHuman-readable GPS location, for example: country and city. IP address of the device at the time of transaction.
device_ip
StringIP address of the device at the time of transaction.
device_risk_score
StringRisk score assigned by merchant’s system.
Potential enum values: high, medium, low.
Potential enum values: high, medium, low.
additional_info
StringAny extra device-related risk information not covered by the structured fields.
user_account
ObjectShow child child parameters
user_id
StringIdentifier that uniquely represents the user in the merchant’s system.
phone_number
StringAt least one of phone_number, email, or username must be provided.
At least one of phone_number, email, or username must be provided.
username
StringAt least one of phone_number, email, or username must be provided.
account_registration_time
StringTimestamp when the user account was first registered with the merchant.
account_risk_score
StringRisk score assigned to the user account by the merchant.
Potential enum values: high, medium, low.
Potential enum values: high, medium, low.
merchant_account
ObjectShow child child parameters
merchant_name
StringMerchant business name
merchant_id
StringIdentifier for each unique merchant onboarded by payment facilitator (most aggregated level)
merchant_mcc
StringMerchant Category Code (MCC). Leave blank if the external merchant differentiates only by store level.
merchant_address
ObjectShow child child parameters
region
StringRegistered address of the merchant. Leave blank if you only differentiate at store/outlet level.
state
Stringcity
Stringaddress
Stringpostal_code
Stringstore
ObjectShow child child parameters
store_name
StringIf external merchant differentiates by store / outlet, to get store / outlet info.
otherwise leave blank.
otherwise leave blank.
store_id
StringIf external merchant differentiates by store / outlet, to get store / outlet info.
otherwise leave blank.
otherwise leave blank.
store_mcc
StringIf external merchant differentiates by store / outlet, to get store / outlet info.
otherwise leave blank.
otherwise leave blank.
store_address
ObjectShow child child parameters
region
StringIf external merchant differentiates by store / outlet, to get store / outlet info.
otherwise leave blank.
otherwise leave blank.
state
Stringcity
Stringaddress
Stringpostal_code
Stringorder_details
ObjectShow child child parameters
payment_initiation
StringIndicates how the payment is initiated.
Potential value:
Potential value:
MERCHANT_QR_PROPRIETARY: Merchant-presented proprietary QR scanned by the customer to initiate payment.MERCHANT_QR_NATIONAL: Merchant-presented national / standardized QR scanned by the customer to initiate payment.CUSTOMER_QR_PROPRIETARY: Customer-presented proprietary QR scanned by the merchant to initiate payment.CUSTOMER_QR_NATIONAL: Customer-presented national / standardized QR scanned by the merchant to initiate payment.ONLINE_CHECKOUT: Online checkout where the customer confirms an order and pays with a non-QR method (card, wallet, giro, etc.).SUBSCRIPTION: Recurring or scheduled billing initiated automaticallyTRANSFER: Fund transfer between accounts (for example, P2P or internal balance movement) without an order/cart.
description
StringFree-text description of the charge.
shipping_address
ObjectShow child child parameters
region
StringShipping address where goods are delivered. Mandatory for online merchants except for purely virtual goods.
state
Stringcity
Stringaddress
Stringpostal_code
Stringmerchant_additional_info
StringAdditional merchant-specific information for this order, if any.
items
ObjectShow child child parameters
item_name
Stringitem name user bought in online platform or App.
item_quantity
Intitem number user bought in online platform or App.
item_currency
Stringitem currency Example, SGD.
item_amount
Int64item amount
item_category
StringCategory of the item (merchant-defined taxonomy).
qr_details
ObjectShow child child parameters
qr_type
StringPotential values: 'static' or 'dynamic'.
qr_create_time
StringCreation timestamp for dynamic QR codes.
qr_source
StringHow the user submitted the QR for payment.
Potential values: 'scan'; 'upload'
Potential values: 'scan'; 'upload'
national_qr_payload
StringRaw national QR payload string as defined by the national QR standard.
Sample API 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": 100,"currency": "IDR","use_coin": true}
Copy
Response Parameters
request_id
stringThe same value as the
request_id in the request.errcode
int32Error code to specify the error returned.
debug_msg
stringDebug message to provide more information.
transaction
objectWill not be returned if the transaction fails.
Show child child parameters
reference_id
stringUnique identifier of payment transaction generated by merchant. Same value as
payment_reference_id.amount
int64Amount used for the payment, inflated by a factor of 100. A positive integer in the smallest currency unit, with no decimal point. Example:Smallest amount will be 1, which represents 0.01.For currencies that do not have denomination in cents, the smallest amount will be 100, which represents 1 IDR (Rp 1) or 1 VND (₫ 1).
status
uint32Refer to Transaction Status for specific transaction statuses.
transaction_type
uint3213, referring to subscription transaction type. Refer to Transaction Types for specific transaction types.
transaction_sn
stringTransaction identifier in ShopeePay's system.
create_time
uint32Create time of the transaction.
update_time
uint32Update time of the transaction.
user_id_hash
stringIdentifier for the customer that made the payment.
merchant_ext_id
stringUnique identifier of merchant in merchant's system.
store_ext_id
stringUnique identifier of store in merchant's system.
promo_id_applied
stringpromo_ids applied to the payment transaction.payment_channel
uint32Indicates the source of funds used. Refer to Payment Channels for the respective source of fund.
Sample API Response
{"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}}
Copy
Response Code
| Value | Description |
|---|---|
| -2 | A server dropped the connection |
| -1 | A server error occurredPlease use Check Transaction Status endpoint to query the updated status of the payment |
| 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 |
| 5 | Transaction is in processing status, use Check Transaction Status endpoint to query the updated status of the payment |
| 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 |
| 1601 | Error due to invalid promotion |