Merchant Presented Mode

Merchant Workflow

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

  1. Display a static QR or generate a dynamic QR for scanning

  2. Once customer scans QR, merchant needs to handle the payment result returned

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

  1. Merchant generates QR code by calling ShopeePay Create Dynamic QR for MPM endpoint.
  2. Customer opens payment app, and scans the dynamic QR code presented by the merchant.
  3. ShopeePay system returns the transaction result to the merchant. Meanwhile, customers will also see the updated payment result.
  4. ShopeePay also sends an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
  5. 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, 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 until the payment expires. Alternatively, merchants can call the Invalidate endpoint to terminate the transaction.
    • 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 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.
  6. For Refund, if the transaction is in Processing status or has no response, keep inquiring with an incremental frequency up to 24 hours.

Create Dynamic QR for MPM

Specification

HTTP MethodPOST
Service Code47
Path.../v1.0/qr/qr-mpm-generate
Versionv1.0

Request Parameters

FieldTypeMandatoryDescription
partnerReferenceNoStringMUnique identifier for request
  • Accepts up to 64 characters
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
feeAmountObjectO
  • value
StringCConvenience fee amount charged by the merchant.
  • This field is mandatory if convenienceFeeIndicator value is 02 or 03
  • For convenienceFeeIndicator = 03, specify the fee as percentage
  • For 10% fee, enter 10.00
  • currency
StringCCurrency that is associated with the transaction fee amount
  • Accepted values: IDR
  • This field is mandatory if convenienceFeeIndicator value is 02 or 03.
merchantIdStringMUnique identifier of merchant in merchant’s system.
  • Accepts up to 64 characters.
validityPeriodStringO
  • By default, the expiry time will be set to 1200 seconds (20 minutes), from the time the request was received.
    • Accepts up to 432,000 seconds (5 days) from the time request was received
  • If this field is filled, the QR code containing the partnerReferenceNo in this request will expire and payment that QR code will fail after the specified period.
  • Using ISO 8601 timestamp format.
terminalIdStringOUnique identifier of store terminal.
additionalInfoObjectM
  • externalStoreId
StringMUnique identifier of store in merchant system.
  • Accepts up to 64 characters.
  • convenienceFeeIndicator
StringO
  • Convenience fee can be fixed, or percentage of the payment amount.
  • Accepted values:
    • 01 - Customer inputs fee amount
    • 02 - Convenience fee is a fixed value, to be indicated in feeAmount
    • 03 - Convenience fee is based on percentage of payment, to be indicated in feeAmount
  • 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",
"amount": {
"value": "10000.00",
"currency": "IDR"
},
"feeAmount": {
"value": "1000.00",
"currency": "IDR"
},
"merchantId": "Merchant123",
"validityPeriod": "2022-07-07T07:15:00+07:00",
"terminalId": "T2903",
"additionalInfo": {
"externalStoreId": "Store123",
"convenienceFeeIndicator": "02",
"promoIds": "Promo1,Promo2",
"metadata": "{"field1":"{Data1}","field2":"{Data2}" ,"field3":"{Data3}"}"
}
}
arrow-svg

Copy

Response Parameters

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
qrContentStringOQR string in plain text.
qrUrlStringOURL to download QR image, URL is valid for 5 minutes.
additionalInfoObjectO
  • storeName
StringOName of the store onboarded to ShopeePay.

Sample API Response

REQUEST

{
"responseCode": "2004700",
"responseMessage": "Successful",
"qrContent": "00020101021226540016ID.CO.SHOPEE.WWW011893600918002024585002082024585052041234530336054041.0058021D5911test6007Bandung61054016362200516-1 July 20-126304D0A9",
"qrUrl": "https://xxx.co.id/v3/merchant-host/qr/download?qr=K4aRLCjAqjXYxIFavFxz0EPRX5CfG4nnzgEauynlIL",
"additionalInfo": {
"storeName": "Test Account"
}
}
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
20047002004700SuccessfulMark MPM generate process to Success. Display QR to customer
40047004004700Bad RequestMark MPM generate process to Failed. Retry request with proper parameter
40047014004701
  • Invalid field format {fieldName}
  • Invalid field format {timestamp}
  • Invalid field format {validityPeriod}
  • Invalid field format {promIds}
  • Invalid field format {partnerReferenceNo}. Exceed maximum 64 characters
  • Invalid field format {convenienceFeeIndicator}
  • Invalid field format {terminalId}
  • 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}
Mark MPM generate process to Failed. Retry request with proper parameter
40047024004702
  • Invalid mandatory field {fieldName}
  • Invalid mandatory field {partnerReferenceNo}
  • Invalid mandatory field {currency}
  • Invalid mandatory field {externalStoreId}
  • Invalid mandatory field {merchantId}
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid mandatory field {feeAmount.value}
  • Invalid Mandatory Field + {error message}
Mark MPM generate process to Failed. Retry request with proper parameter
40047134004713
  • Invalid amount.
  • Fee amount does not support cents
  • Invalid amount.
  • Non-positive amount is not allowed
Mark MPM generate process to Failed. Retry request with proper parameter
40147004014700
  • Unauthorized. Invalid Client Key
  • Unauthorized.{error message}
Mark MPM generate process to Failed. Retry request with proper parameter
40147014014701Invalid TokenMark MPM generate process to Failed. Retry request with proper parameter
40347024034702Exceeds Transaction Amount LimitMark MPM generate process to Failed. Retry request with proper parameter
40447084044708
  • Invalid merchant
  • Invalid store
  • Invalid Field Format
Mark MPM generate process to Failed. Contact Shopeepay to check merchant/store status
40447134044713Invalid amount. Currency does not support centsMark MPM generate process to Failed. Retry request with proper parameter
40447184044718Inconsistent RequestMark MPM generate process to Failed. Retry request with proper parameter
40947004094700ConflictMark MPM generate process to Failed. Retry request periodically or consult to Shopeepay
50047005004700General ErrorMark MPM generate process to Failed. Retry request periodically or consult to Shopeepay
50047015004701Internal Server ErrorMark MPM generate process to Failed. Retry request periodically or consult to Shopeepay
50447005044700TimeoutMark MPM generate process to Failed. Retry request periodically or consult to Shopeepay

Invalidate QR for MPM

  • Use this endpoint to invalidate the payment reference id in a payment code for Merchant Presented Mode (MPM) if the order in the merchant's system is closed/canceled. Once the QR is invalidated successfully, the corresponding QR code containing the payment reference ID can no longer be used to make payment.
  • All API requests require a header. Refer to API Param Specification → Transaction Request

Specification

The following table is the specification of the API:

HTTP MethodPOST
Service Code77
Path.../v1.0/qr/qr-mpm-cancel
Versionv1.0

Request Parameter

FieldTypeMandatoryDescription
originalPartnerReferenceNoStringMUnique identifier of the transaction client would like to invalidate/cancel.
merchantIdStringMUnique identifier of merchant in merchant system.
externalStoreIdStringMUnique identifier of store in merchant system.
reasonStringMCancellation reason.
  • Accepts up to 256 characters.

Sample API Request

REQUEST

{
"originalPartnerReferenceNo": "Testing-123",
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"reason": "Cancel order"
}
arrow-svg

Copy

Response Parameter

FieldTypeMandatoryDescription
responseCodeStringMError code to specify the error returned.
responseMessageStringMDebug message to provide more information.
cancelTimeStringCUpdate time of the individual transaction.
  • The value will be returned for successful invalidate request.
  • Using ISO-8601 timestamp format.
originalReferenceNoStringCTransaction identifier in ShopeePay system that is shown to the customer. The value will be returned for successful payment.

Sample API Response

RESPONSE

{
"responseCode": "2007700",
"responseMessage": "Successful",
"cancelTime": "2022-07-21T07:15:00+07:00",
"originalReferenceNo": "123323887564698876"
}
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
20077002007700Successful
  • Mark MPM cancel process to Success.
  • Mark MPM payment status to failed.
40077004007700Bad RequestMark MPM cancel process to Failed. Retry request with proper parameter
40077014007701Invalid field format {fieldName}Mark MPM cancel process to Failed. Retry request with proper parameter
40077024007702
  • Invalid mandatory field {fieldName}
  • Invalid mandatory field {originalPartnerReferenceNo}
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid Mandatory Field + {error message}
40177004017700
  • Unauthorized. Invalid Client Key
  • Unauthorized.{error message}
Mark MPM cancel process to Failed. Retry request with proper parameter
40177014017701Invalid TokenMark MPM cancel process to Failed. Retry request with proper parameter
40377014037701Feature Not AllowedMark MPM cancel process to Failed. Contact Shopeepay to check merchant/store supported product flow
40377064037706Feature Not Allowed. Service Is Temporarily Down For Scheduled MaintenanceMark MPM cancel process to Failed. Retry request periodically or consult to Shopeepay
40377154037715
  • Transaction Not Permitted. Transaction Already In Final State
  • Transaction Not Permitted. Merchant Info Mismatch
  • Transaction Not Permitted. QR Code Can Not Be Invalidated
Mark MPM cancel process to Failed. Request "Check MPM Transaction Status" to get final status
40477014047701Transaction Not FoundMark MPM cancel process to Failed. Retry request with proper parameter
40477084047708
  • Invalid Merchant
  • Invalid Store
  • Invalid {fieldName}
Mark MPM cancel process to Failed. Contact Shopeepay to check merchant/store status
40977004097700ConflictMark MPM cancel process to Failed. Retry request periodically or consult to Shopeepay
50077005007700General ErrorMark MPM cancel process to Failed. Retry request periodically or consult to Shopeepay
50077015007701Internal Server ErrorMark MPM cancel process to Failed. Retry request periodically or consult to Shopeepay
50477005047700TimeoutMark MPM cancel process to Failed. Retry request periodically or consult to Shopeepay

Check MPM Transaction Status

Use this endpoint to query the status of a transaction across all supported service codes.

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 latestTransctionStatus 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 Code51
Path.../v1.0/qr/qr-mpm-query
Versionv1.0

Request Parameter

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.
serviceCodeStringMService code of original transaction, which could be 47 (payment) or 78 (refund).
additionalInfoStringM
  • value
StringMTransaction amount., including cents
  • Sample: 10.000,00 will be placed with 10000.00

Sample API Request

REQUEST

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

Copy

Response Parameter

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
serviceCodeStringMService code of original transaction, which could be 47 (payment) or 78 (refund).
latestTransactionStatusStringM
paidTimeStringCUpdate time of the individual transaction. The value will be returned for successful payment. Using ISO-8601 timestamp format.
amountObjectO
  • value
StringMTransaction amount.
  • Sample: 10.000,00 will be placed with 10000.00
  • currency
StringMCurrency that is associated with the refund amount
  • Accepted values: IDR
terminalIdStringOIf terminal ID info exists in transaction.
additionalInfoObjectO
  • createTime
StringOCreate time of the individual transaction.
  • Using ISO-8601 timestamp format
  • productType
uint32O
  • Indicates the payment method used. Refer to Product Types for the respective payment methods
  • transactionType
uint32ORefer to Transaction Types for specific transaction types
  • merchantId
StringOUnique identifier of merchant’s in merchant system.
  • externalStoreId
StringOUnique identifier of store in merchant’s system.
  • userIdHash
StringOUnique identifier of the customer making the payment.
  • 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.

Sample API Response

RESPONSE

{
"responseCode": "2005100",
"responseMessage": "Successful",
"originalReferenceNo": "Payment-123",
"originalPartnerReferenceNo": "Testing-123",
"serviceCode": "47",
"latestTransactionStatus": "00",
"paidTime": "2022-07-20T07:20:00+07:00",
"amount": {
"value": "10000.00",
"currency": "IDR"
},
"terminalId": "2903",
"additionalInfo": {
"productType": 2,
"transactionType": 13,
"createTime": "2022-07-20T07:05:00+07:00",
"userIdHash": "15e455125fba426a4a2bb9145b3af2906813a7f222f6eab93b026ead62dc8d76",
"merchantId": "Merchant123",
"externalStoreId": "Store123",
"promoIdApplied": "Promo1, Promo2",
"paymentChannel": 1
}
}
arrow-svg

Copy

Response Codes

HTTP codeService CodeSub-error CodeResponse CodeResponse MessagePartner Action
20051002005100SuccessfulMark MPM payment to corresponding status according to response.additionalInfo.latestTransactionStatus. Retry request periodically if didn't get final status
40051004005100Bad RequestMark MPM Payment to Pending. Retry request with proper parameter
40051014005101
  • 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 Field Form
Mark MPM Payment to Pending. Retry request with proper parameter
40051024005102
  • Invalid mandatory field {fieldName}
  • Invalid mandatory field {partnerReferenceNo}
  • Invalid mandatory field {merchantId/externalStoreId}
  • Invalid mandatory field {merchantId}. Exceed maximum character length
  • Invalid mandatory field {externalStoreId}. Exceed maximum character length
  • Invalid Amount. Amount cannot contain cents
  • Invalid Mandatory Field + {error message}
40151004015100
  • Unauthorized Invalid Client Key
  • Unauthorized.{error message}
Mark MPM Payment to Pending. Retry request with proper parameter
40151014015101Invalid TokenMark MPM Payment to Pending. Retry request with proper parameter
40451014045101Transaction Not FoundMark MPM Payment to Failed
40451084045108
  • Entity not found
  • Invalid Field Format
  • Invalid Merchant, Status Is Not Active
  • Invalid Store, Status is Not Active
Mark MPM Payment to Pending. Retry request periodically or consult to Shopeepay
40451134045113
  • Invalid Amount. Mismatch With Original Transaction
  • Invalid Amount. Non Positive Amount Is Not Allowed
Mark MPM Payment to Pending. Retry request with proper parameter
40951004095100ConflictMark MPM Payment to Pending. Retry request periodically or consult to Shopeepay
50051005005100General ErrorMark MPM Payment to Pending. Retry request periodically or consult to Shopeepay
50051015005101Internal Server ErrorMark MPM Payment to Pending. Retry request periodically or consult to Shopeepay
50451005045100TimeoutMark MPM 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 Code78
Path.../v1.0.2/qr/qr-mpm-refund
Versionv1.0.2

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-mpm-generate request before considering the payment successful.

HTTP MethodPOST
Service Code52
Path.../v1.0/debit/notify
Versionv1.0

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