Customer Presented Mode (CPM)

Merchant Workflow

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

  1. Identify and verify the QR code

  2. Initiate a payment request

  3. Handle the payment result returned

The following figure illustrates the workflow of accepting a payment in the Customer Presented Mode payment scenario:

  1. Customer opens a payment app, and presents a payment code (QR or barcode) to the merchant.
  2. Merchant scans the customer's payment code.
  3. Merchant sends a payment request to ShopeePay via Create CPM Payment endpoint.
  4. 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.
  5. ShopeePay also sends an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
  6. Merchants can also call the Check Transaction Status endpoint to query the status of the transaction.
    • If the response code is "Success" and latestTransactionStatus is 00, 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 until the payment expires.
    • 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
  7. For Refund, if the transaction is in a Processing status or has no response, keep inquiring with an incremental frequency up to 24 hours.

Create CPM Payment

Specification

The following table is a specification of this API:

HTTP MethodPOST
Service Code60
Path../v1.0.2/qr/qr-cpm-payment
Versionv1.0.2

Request Parameters

FieldTypeMandatoryDescription
partnerReferenceNoStringMUnique identifier for request Accepts up to 64 characters.
qrContentStringMQR content from the user’s CPM QR code.
amountObjectM
  • value
StringMTransaction amount.
  • Sample: 10.000,00 will be placed with 10000.00
  • currency
StringMCurrency that is associated with the payment 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.
expiryTimeStringOThe transaction with the corresponding partnerReferenceNo in this request will fail after the specified expiry time.
  • Expiry time will have a min value of 30s.
  • Sample: 2020-12-21T17:21:41+07:00
terminalIdStringOTerminal ID refers to the Point of Sale terminal in a store.
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.
  • 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}\”}

Sample API Request

REQUEST

{
"partnerReferenceNo": "input-unique-request-id-here",
"qrContent": "hQVDUFYwMWFiTwegAAAGAiAgUAdRUklTQ1BNWgqTYAkYMABRhWgPnyUCVoCfdi9kLd4UOTE4MDM1NjIxNzE2NjA4OTE3NDnEBIATEA/FAQ/HCVNob3BlZVBhecsBAWMLn3QINjA4OTE3NDk=",
"amount": {
"value": "10000.00",
"currency": "IDR"
},
"merchantId": "Merchant123",
"externalStoreId": "2233",
"expiryTime": "2020-12-21T17:21:41+07:00",
"terminalId": "T2903",
"additionalInfo": {
"promoIds": "Promo1,Promo2",
"metadata": "{\"field1\":\"Data1\",\"field2\":\"Data2\" ,\"field3\":\"Data3\"}"
}
}
arrow-svg

Copy

Response Parameter

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
referenceNoStringCTransaction identifier in ShopeePay system.
  • Will be filled upon successful transaction.
partnerReferenceNoStringOUnique identifier of payment transaction generated by merchant.
transactionDateStringOCreate time of the transaction.
  • Using ISO-8601 timestamp format.
additionalInfoObjectO
  • updateTime
StringOUpdate time of the transaction. Using ISO-8601 timestamp format.
  • transactionType
uint32O13
  • merchantId
StringOUnique identifier of merchant in merchant’s system.
  • externalStoreId
StringOUnique identifier of store in merchant’s system.
  • terminalId
StringOTerminal ID refers to the Point of Sale terminal in a store.
  • userIdHash
StringOUnique identifier of the user making the payment.
  • latestTransactionStatus
StringORefer to Transaction Status for specific transaction statuses
  • 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. Refer to Payment Channels for the respective source of fund.

Sample API Response

RESPONSE

{
"responseCode": "2006000",
"responseMessage": "Successful",
"referenceNo": "Payment-123",
"partnerReferenceNo": "input-unique-request-id-here",
"transactionDate": "2022-07-07T07:15:00+07:00",
"additionalInfo": {
"updateTime": "2022-07-07T07:15:01+07:00",
"transactionType": 13,
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"terminalId": "T2903",
"userIdHash": "15e455125fba426a42bb9145b3af2906813a7f222f6eab93b026ead62dc8d76",
"latestTransactionStatus": "00",
"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
20060002006000SuccessfulMark CPM payment process to corresponding status according to response.additionalInfo.latestTransactionStatus. Retry request "Check CPM Transaction Status" periodically if didn't get final status
40060004006000Bad RequestMark CPM Payment process to Failed. Retry request with proper parameter
40060014006001
  • Invalid Field Format
  • Invalid mandatory field externalStoreId
  • Invalid Field Format additionalInfo. Exceed Maximum Characters
  • Invalid Field Format {metadata}
Mark CPM Payment process to Failed. Retry request with proper parameter
40060024006002
  • Invalid mandatory field {qrContent}
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid mandatory field partnerReferenceNo
  • Invalid Mandatory field partnerReferenceNo. Exceed maximum characters
  • Invalid mandatory field merchantId
  • Invalid mandatory field merchantId. Exceed maximum characters
  • Invalid mandatory field externalStoreId
  • Invalid mandatory field {qrContent}
  • Invalid amount
  • Amount cannot be non-positive
  • Payment amount exceeds max amount limit
  • Invalid mandatory field currency
  • Currency and region are non-matching
  • Invalid Mandatory Field + {error message}
Mark CPM Payment process to Failed. Retry request with proper parameter
40160004016000Unauthorized.{error message}Mark CPM Payment process to Failed. Retry request with proper parameter
40160014016001Invalid TokenMark CPM Payment process to Failed. Retry request with proper parameter
40360004036000TimeoutMark CPM Payment process to Pending. Retry request "Check CPM Transaction Status" to get final status.
40360014036001Feature Not Allowed. Selected Payment Channel Is Disabled For MerchantMark CPM Payment process to Failed. Retry request periodically or consult to Shopeepay
40360024036002Exceeds Transaction Amount LimitMark CPM Payment process to Failed. Try to adjust the order amount
40360034036003Suspected FraudMark CPM Payment process to Failed. Retry request periodically or consult to Shopeepay
40360054036005
  • Do Not Honor. User Is Banned
  • Do Not Honor. User Is Locked
  • Do Not Honor. User Is Deleted
  • Do Not Honor. User Is Not Activated
  • Do Not Honor. User Is Not Found
Mark CPM Payment process to Failed. Retry request with proper parameter or can contact Shopeepay to check the user/account status
40360064036006Feature Not Allowed. Service Is Temporarily Down For Scheduled MaintenanceMark CPM Payment process to Failed. Retry request periodically or consult to Shopeepay
40360144036014
  • Insufficient Funds
  • Insufficient Funds. Insufficient SPayLater Credit Limit
Mark CPM Payment process to Failed. Retry later or change payment channel
40360154036015
  • Transaction Not Permitted. Merchant Is Trying To Make Payment To Their Own User Account
  • Transaction Not Permitted. Unable To Use Coin
  • Transaction Not Permitted. Payment Channel Is Not Supported
  • Transaction Not Permitted. Amount Not Meet Minimum Spend Voucher
  • Transaction Not Permitted. Promo_ids Is Not Matched
  • Transaction Not Permitted. Promo_ids Has Been Used
  • Transaction Not Permitted. Promo_ids Not Applicable
  • Transaction Not Permitted. Promo_ids Not Match With Store
  • Transaction Not Permitted. Voucher Is Expired
  • Transaction Not Permitted. Payment Channel Selected By The User Currently May Not Used For This Transaction. Please Advise The User To Select Another Payment Method And Try Again
  • Transaction Not Permitted. There Is An Ongoing Payment For This Transaction
  • Transaction Not Permitted. Cashback Is Not Allowed
  • Transaction Not Permitted. OTP or 3DS Verification Failed
Mark CPM Payment process to Failed. Retry request with proper parameter
40460014046001
  • qrContent Expired
  • qrContent Not Found
Mark CPM Payment process to Failed. Retry request with another QR code
40460084046008
  • Invalid Merchant, Status is Not Active
  • Invalid Store, Status is Not Active
  • Invalid Field format
  • Invalid Merchant
Mark CPM Payment process to Failed. Retry request periodically or contact Shopeepay to check merchant/store status
40460134046013Invalid amount. Currency doesn't support centsMark CPM Payment process to Failed. Retry request with proper parameter
40460184046018Inconsistent RequestMark CPM Payment process to Failed. Retry request with proper parameter
40960004096000ConflictMark CPM Payment process to Pending. Retry request "Check CPM Transaction Status" to get final status
50060015006001Internal Server ErrorMark CPM Payment process to Pending. Retry request "Check CPM Transaction Status" to get final status
50460005046000TimeoutMark CPM Payment process to Pending. Retry request "Check CPM Transaction Status" to get final status

Check CPM Transaction Status

  • Use this endpoint to query the status of a CPM transaction.
  • Check CPM Transaction Status API can't be used for CPM transactions that are not made using ShopeePay Payment API.

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 LatestTransactionStatus field in the API response. This will provide the most up-to-date information.

Specification

The following table is a specification of this API:

HTTP MethodPOST
Service Code61
Path.../v1.0/qr/qr-cpm-query
Versionv1.0

Request Parameters

FieldTypeMandatoryDescription
originalPartnerReferenceNoStringMUnique identifier of the transaction merchant would like to query, which could be partnerReferenceNo to check payment transaction, or partnerRefundNo to check refund transaction.
merchantIdStringMUnique identifier of merchant in merchant’s system.
externalStoreIdStringMUnique identifier of store in merchant’s system.
additionalInfoStringM
  • value
StringMTransaction amount
  • Sample: 10.000,00 will be placed with 10000.00
  • serviceCode
StringMService code of original transaction, which could be 60 (create CPM payment) or 80 (refund).

Sample API Request

REQUEST

{
"originalPartnerReferenceNo": "Testing-123",
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"additionalInfo": {
"serviceCode": "61",
"value": 10000
}
}
arrow-svg

Copy

Response Parameters

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.
latestTransactionStatusStringM
paidTimeStringMUpdate time of the individual transaction.
  • Using ISO-8601 timestamp format.
additionalInfoObjectO
  • value
StringOTransaction amount.
  • Sample: 10.000,00 will be placed with 10000.00
  • currency
StringOCurrency that is associated with the refund amount
  • Accepted values: IDR
  • createTime
StringOCreate time of the individual transaction.
  • Using ISO-8601 timestamp format.
  • productType
uint32OIndicates the payment method used. Refer to Product Types for the respective payment methods
  • transactionType
uint32ORefer to Transaction Types for specific transaction types
  • serviceCode
StringOService code of original transaction, which could be 60 (create CPM payment) or 80 (refund).
  • merchantId
StringOUnique identifier of merchant in merchant’s system.
  • externalStoreId
StringOUnique identifier of store in merchant’s system.
  • userIdHash
StringOUnique identifier of the customer making the payment.
  • terminalId
StringOIf terminal ID info exists in transaction.
  • 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. Refer to Payment Channels for the respective source of fund.

Sample API Response

RESPONSE

{
"responseCode": "2006100",
"responseMessage": "Successful",
"originalReferenceNo": "Payment-123",
"originalPartnerReferenceNo": "Testing-123",
"latestTransactionStatus": "00",
"paidTime": "2022-07-07T15:00:01+07:00",
"additionalInfo": {
"value": "100.00",
"currency": "IDR",
"createTime": "2022-07-07T15:00:00+07:00",
"productType": 4,
"transactionType": 13,
"serviceCode": "60",
"merchantId": "externalmerchant",
"externalStoreId": "externalstore",
"terminalId": "T2903",
"userIdHash": "15e455125fba426a4a2bb9145b3af2906813a7f222f6eab93b026ead62dc8d76",
"promoIdApplied": "Promo1, Promo2",
"paymentChannel": 1
}
}
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
20061002006100SuccessfulMark CPM payment to corresponding status according to response.additionalInfo.latestTransactionStatus. Retry request periodically when didn't get final status
40061004006100Bad RequestMark CPM Payment to Pending. Retry request with proper parameter
40061014006101
  • 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 CPM Payment to Pending. Retry request with proper parameter
40061024006102
  • 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 CPM Payment to Pending. Retry request with proper parameter
40061084006108
  • Invalid Field format
  • Invalid Merchant
Mark CPM Payment to Pending. Retry request with proper parameter
40161004016100
  • Unauthorized. Invalid Client Key
  • Unauthorized.{error message}
Mark CPM Payment to Pending. Retry request with proper parameter
40161014016101Invalid TokenMark CPM Payment to Pending. Retry request with proper parameter
40361084036108
  • Invalid Merchant, Status Is Not Active
  • Invalid Store, Status Is Not Active
Mark CPM Payment to Pending. Retry request periodically or consult to Shopeepay
40461014046101Transaction not foundMark CPM Payment to Failed
40461084046108Entity not foundMark CPM Payment to Pending. Retry request periodically or consult to Shopeepay
40461134046113
  • Invalid amount. Mismatch with original transaction
  • Invalid Amount. Non Positive Amount Is Not Allowed
Mark CPM Payment to Pending. Retry request with proper parameter
40961004096100ConflictMark CPM Payment to Pending. Retry request periodically or consult to Shopeepay
50061005006100General ErrorMark CPM Payment to Pending. Retry request periodically or consult to Shopeepay
50061015006101Internal Server ErrorMark CPM Payment to Pending. Retry request periodically or consult to Shopeepay
50461005046100TimeoutMark CPM 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 Code80
Path.../v1.0/qr/qr-cpm-refund
Versionv1.0

Refer to Refund Payment endpoint for the 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 /qr/qr-cpm-payment request before considering the payment successful.

HTTP MethodPOST
Service Code79
Path.../v1.0/qr/qr-cpm-notify
Versionv1.0

Refer to Notify Transaction Status endpoint for the detail request body and response parameters.