Subscription

Merchant Workflow

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

  1. Completed account linking request and store returned access token
  2. Initiate a payment request for Subscription when payment is due
  1. Merchant calls Create Payment Order: Subscription endpoint to charge from the customer’s ShopeePay account.
  2. ShopeePay will conduct a sequential attempt with each of the customer’s linked payment methods with ShopeePay, until the transaction is successful.
  3. ShopeePay will sends an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
  4. 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

stringRequired
Unique identifier of the API request.

access_token

stringRequired
The access token that was obtained from ShopeePay via the Get Access Token API, representing the user's authorization.

merchant_ext_id

stringRequired
Unique identifier of the merchant in the merchant's system.

store_ext_id

stringRequired
Unique identifier of the store in the merchant's system.

amount

int64
The 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.

language

string
Language in which the linked payment methods are displayed. The default is English.

Possible values:

  • Indonesian : id
  • English: en
  • Malay: ms
  • Thai: th
  • Vietnamese:vi

additional_info

object
Show child child parameters

field1

string
Any Payment Remark for ShopeePay Clearing Order Report. This can be a customized value for reconciliation purpose.

field2

string
Any Payment Remark for ShopeePay Clearing Order Report. This can be a customized value for reconciliation purpose.

field3

string
Any Payment Remark for ShopeePay Clearing Order Report. This can be a customized value for reconciliation purpose.

merchant_device_info

json string
Show child child parameters

device_identifier_info

Show child child parameters

device_id

Merchant-generated unique identifier for the user’s device (not an OS-level identifier).

iosudid

Unique device identifier for iOS devices.

imei

Unique device identifier such as IMEI (for compatible devices).

os_version

Operating system and version, for example: “iOS 16”, “Android 14”.

brand

Brand of the device, for example: “Apple”, “Samsung”

model

Model of the device, for example: “iPhone 14”, “Galaxy S24”.

risk_tags

Show child child parameters

is_jailbreak

Boolean. true if the device is jailbroken (iOS) or rooted (Android)

is_emulator

Boolean. true if the app is running in an emulator environment (for example Genymotion).

is_remote_control_enabled

Boolean. true if remote access / remote control tools (for example TeamViewer, scrcpy) are active

is_gps_modified

Boolean. true if GPS appears tampered or inconsistent (possible GPS modification).

has_fake_gps_app_installed

Boolean. true if known fake-GPS apps are installed on the device.

location_info

Show child child parameters

latitude

Device latitude at the time of transaction.

longitude

Device longitude at the time of transaction.

location

Human-readable GPS location, for example: country and city.IP address of the device at the time of transaction.

device_behavior_info

Show child child parameters

verification_completion_method

Verification method used within the merchant app to complete the current session or transaction.
Potential enum:

  • none
  • biometric
  • pin
  • password
  • pattern
  • other

device_first_login_timestamp

Earliest timestamp when this device first logged in to the merchant app.

device_risk_score

Risk score assigned by merchant’s system.
Potential enum values: high, medium, low.

network_risk_info

Show child child parameters

device_ip

IP address of the device at the time of transaction.

additional_info

Additional merchant-specific information relates to device info, if any.

merchant_user_account_info

json string
Show child child parameters

user_identifier_info

Show child child parameters

user_id

Identifier that uniquely represents the user in the merchant’s system.

phone_number

At least one of phone_number, email, or username must be provided.

email

username

account_time_info

Show child child parameters

account_registration_time

Timestamp when the user account was first registered with the merchant.

account_risk_info

Show child child parameters

account_risk_score

Risk score assigned to the user account by the merchant. Potential enum values: high, medium, low.

customized_partner_merchant_info

json string
Show child child parameters

merchant_basic_info

Show child child parameters

merchant_name

Merchant’s business name.

merchant_id

identifier for each unique merchant onboarded by payment facilitator (most aggregated level)

merchant_mcc

Merchant Category Code (MCC). Leave blank if the external merchant differentiates only by store level.

merchant_address

Show child child parameters

region

Registered address of the merchant. Leave blank if you only differentiate at store/outlet level.

state

city

address

postal_code

store_basic_info

Show child child parameters

store_name

if external merchant differentiates by store / outlet, to get store / outlet info. otherwise leave blank.

store_id

if external merchant differentiates by store / outlet, to get store / outlet info. otherwise leave blank.

store_mcc

if external merchant differentiates by store / outlet, to get store / outlet info. otherwise leave blank.

store_address

Show child child parameters

region

Registered address of the merchant. Leave blank if you only differentiate at store/outlet level.

state

city

address

postal_code

order_detail

json string
Show child child parameters

shipping_address

Show child child parameters

region

Registered address of the merchant. Leave blank if you only differentiate at store/outlet level.

state

city

address

postal_code

item_info

Show child child parameters

name

item name user bought in online platform or App

quantity

item number user bought in online platform or App

currency

item currency Example, SGD

amount

item amount

category

Category of the item (merchant-defined taxonomy).

additional_info

Additional merchant-specific information relates to order, if any.

description

Free-text description of the charge.

qr_details

Show child child parameters

qr_type

Potential values: \\"static\\" or \\"dynamic\\"

qr_source

How the user submitted the QR for payment. Potential values: \\"scan\\"; \\"upload\\"

national_qr_payload

Raw national QR payload string as defined by the national QR standard.

payment_initiation

string
Indicates how the payment is initiated.

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 automatically
  • TRANSFER: Fund transfer between accounts (for example, P2P or internal balance movement) without an order/cart.

The following scenarios define which risk field the merchant should provide to SPP:

Payment Initiation ScenarioDescriptionAPI Fields
SETTLEMENTfield1, field2, field3
MERCHANT_QR_PROPRIETARYMerchant-presented proprietary QR scanned by the customer to initiate payment.Device Info, User Account, Merchant Account, Order Details
MERCHANT_QR_NATIONALMerchant-presented national QR scanned by the customer to initiate payment.Device Info, User Account, Merchant Account, Order Details, QR Details (If Merchant who handles QR reading)
CUSTOMER_QR_PROPRIETARYCustomer-presented proprietary QR scanned by the merchant to initiate payment.Device Info, User Account, Merchant Account, Order Details
CUSTOMER_QR_NATIONALCustomer-presented national / standardized QR scanned by the merchant to initiate payment.Device Info, User Account, Merchant Account, Order Details, QR Details (If Merchant who handles QR reading)
ONLINE_CHECKOUTOnline checkout where the customer confirms an order and pays the non-QR method transaction.Device Info, User Account, Merchant Account, Order Details, Items

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
}
arrow-svg

Copy

Response Parameters

request_id

string
The same value as the request_id in the request.

errcode

int32
Error code to specify the error returned.

debug_msg

string
Debug message to provide more information.

transaction

object
Will not be returned if the transaction fails.
Show child child parameters

reference_id

string
Unique identifier of payment transaction generated by merchant. Same value as payment_reference_id.

amount

int64
Amount 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

uint32
Refer to Transaction Status for specific transaction statuses.

transaction_type

uint32
13, referring to subscription transaction type. Refer to Transaction Types for specific transaction types.

transaction_sn

string
Transaction identifier in ShopeePay's system.

create_time

uint32
Create time of the transaction.

update_time

uint32
Update time of the transaction.

user_id_hash

string
Identifier for the customer that made the payment.

merchant_ext_id

string
Unique identifier of merchant in merchant's system.

store_ext_id

string
Unique identifier of store in merchant's system.

promo_id_applied

string
promo_ids applied to the payment transaction.

payment_channel

uint32
Indicates 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
}
}
arrow-svg

Copy

Response Code

ValueDescription
-2A server dropped the connection
-1A server error occurredPlease use Check Transaction Status endpoint to query the updated status of the payment
0Success
1The request parameters is invalid or a mandatory parameter is empty
2Permission denied, often due to invalid status
4Not found, often due to merchant/store/user/transaction not found
5Transaction is in processing status, use Check Transaction Status endpoint to query the updated status of the payment
9Customer’s account is banned
11Duplicated request
14Customer’s account is deleted
24Customer's account is frozen
27Customer's account is not activated
42Insufficient balance
43Insufficient balance
50The request parameters is invalid due to payload sent is not a valid JSON
105Invalid auth code
140Customer’s wallet limit is reached
1001Customer is not allowed to make the transaction
1100ShopeePay internal payment module error
1101ShopeePay internal payment module error
1102Customer’s SPL credit limit is reached
1103Customer is required to link their bank account
1104Ineligible payment channel
1105Transaction failed due to unsuccessful authentication
1106Duplicated payment
1200ShopeePay internal payment module error
1201ShopeePay internal payment module error
1500ShopeePay internal payment module error
1800ShopeePay internal payment module error
1801ShopeePay internal payment module error
1906Unable to process refund due to transaction has been failed
1907Ineligible payment channel
1908Service is temporarily down for scheduled maintenance
1601Error due to invalid promotion