Customer Presented Mode (CPM)
Merchant Workflow
To accept the payment in this scenario, the merchant needs to complete the following steps:
- Identify and verify the QR code
- Initiate a payment request
- Handle the payment result returned
The following figure illustrates the workflow of accepting a payment in the Customer Presented Mode payment scenario:
- Customer opens a payment app, and presents a payment code (QR or barcode) to the merchant.
- Merchant scans the customer's payment code.
- Merchant sends a payment request to ShopeePay via Create CPM Payment endpoint.
- ShopeePay system returns the transaction result to the merchant. Meanwhile, customers will also see the updated payment result.
- When ShopeePay returns "Processing" for a payment transaction, it indicates that the payment process is still ongoing and pending further customer action to select payment method to complete the payment. This case would most likely happen when customer selects SPayLater as payment method.
- ShopeePay also sends 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", the merchant can mark this transaction as successful.
- If the Response Code is "Failed", the merchant can mark this transaction as failed.
- If the transaction is in a "Processing" status or 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 CPM Payment
Use this endpoint to initiate a payment request after scanning a customer’s payment code.
- URL: "/v3/merchant-host/transaction/payment/create"
Request Parameters
Unique identifier for request, accepts up to 64 characters.
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).
Unique identifier of merchant in merchant's system.
Unique identifier of store in merchant's system.
If there's no national QR code standard defined on a national level, this code starts with "918" and contains 20 digits.
- Accepts up to 64 characters
Specify the three-letter ISO currency code following the ISO 4217 standard. Currently supports IDR, MYR, PHP, SGD, THB, and VND.
If this field is filled, the order associated with the corresponding
payment_reference_id in this request will expire after the specified validity period (in seconds).The minimum validity period is 30 seconds and the maximum allowable value is 5 days.
Note: The system will return an error if both
validity_period andexpiry_time parameters are used simultaneously.By default, the expiry time will be set to 120 seconds.
If this field is filled, the order associated with the corresponding
payment_reference_id in this request will be invalid after the specified timestamp. The minimum expiry time allowed will be 30 seconds from the request time and the maximum acceptable expiry time is 5 days.Note: The system will return an error if both
validity_period andexpiry_time parameters are used simultaneously.Terminal ID refers to the Point of Sale terminal in a store.
promo_ids of 100 characters or less (up to 20), if any.These
promo_ids will be checked against promotional campaigns configured in ShopeePay to determine the valid reward amount the customer can receive for this transaction.This field supports up to 3 fields and needs to be sent in this format: {"field1":"{Data1}","field2":"{Data2}" ,"field3":"{Data3}"}
Response Parameters
Unique identifier for request.
Error code to specify the error returned.
Debug message to provide more information.
Note: in Thailand and Vietnam, the name of object
transaction_list is returned as transaction.Note: This field is currently used in Thailand and Vietnam only.
Response Code
Please refer to the following description for a general explanation of the errcode returned during an API Response.
For a more detailed explanation, it is advisable to consult debug_msg. This field provides additional information that can offer valuable insights for troubleshooting.
Merchants may choose to display the debug_msg to their operators or staffs to facilitate prompt identification and resolution of the issue.
| Value | Description |
|---|---|
| -2 | A server dropped the connection |
| -1 | A server error occurred Please 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 |
| 7 | Expired payment code or QR |
| 9 | Customer’s account is banned |
| 11 | Duplicated request |
| 14 | Customer’s account is deleted |
| 15 | Payment amount exceeded payment limit |
| 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 |
| 126 | Customer’s transaction limit is reached |
| 140 | Customer’s wallet limit is reached |
| 301 | Invalid payment code or QR |
| 303 | Unable to make payment to own user account |
| 603 | Ineligible payment channel |
| 604 | Ineligible voucher |
| 630 | SKU ID not matched |
| 702 | Unable to redeem coins |
| 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 |
| 1104 | Ineligible payment channel |
| 1105 | Transaction failed due to unsuccessful authentication |
| 1106 | Duplicated payment |
| 1200 | ShopeePay internal payment module error |
| 1500 | ShopeePay internal payment module error |
| 1600 | ShopeePay internal payment module error |
| 1800 | ShopeePay internal payment module error |
| 1905 | Expired payment code or QR |
| 1908 | Service is temporarily down for scheduled maintenance |