Checkout With ShopeePay

Merchant Workflow

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

  1. Initiate a payment request when customer selects to pay
  2. Handle the redirect URL returned
  3. Handle notification callback or query to check payment results
  1. Customer selects goods or services and proceeds to check out from the merchant's application or website. Merchant sends payment request to ShopeePay server via the Create Checkout Order endpoint. ShopeePay returns redirect_url_http and this URL can be used to direct users to Shopee/ShopeePay application or website.
  2. Customer is redirected to either Shopee/ShopeePay application or website to proceed with payment.
  3. Customer sees the payment details such as payment amount, supported payment methods, and relevant promotional information on the Shopee/ShopeePay application or website.
  4. ShopeePay system returns the transaction result to the merchant. Meanwhile, customers will also see the updated payment result on the Shopee/ShopeePay application or website. ShopeePay also sends an asynchronous message via Notify Transaction Status endpoint to inform merchants on the payment result.
  5. Customer is then redirected back to the merchant's page to view payment status, as specified by the merchant in the redirect_url of the Create Checkout Order endpoint.
  6. Merchants can also call the Check Transaction Status endpoint to query the status of the transaction.
    • If the Response Code is "Success", 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 up to 24 hours. 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 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 Checkout Order

Use this endpoint to create a pending order to be paid by ShopeePay.

  • URL: "/v3/merchant-host/order/create"

Request Parameters

request_idstringRequired

Unique identifier for request, accepts up to 64 characters.

payment_reference_idstringRequired
Unique identifier of transaction generated by merchant.
  • Accepts up to 64 characters
merchant_ext_idstringRequired

Unique identifier of merchant in merchant's system.

store_ext_idstringRequired

Unique identifier of store in merchant's system.

amountint64Required
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).
currencystringRequired
Currency that is associated with the payment amount.
Specify the three-letter ISO currency code following the ISO 4217 standard. Currently supports IDR, MYR, PHP, SGD, THB, and VND.
return_urlstringRequired

Indicates the URL (in HTTP links or URL scheme formats) of the merchant's application to redirect back to once the payment is processed by ShopeePay or when the customer canceled the payment.

platform_typestringRequired
Type of the merchant's platform that the customer triggered the checkout flow from.
Accepted values:
  • "app"
  • "pc"
  • "mweb" (mobile web)
validity_perioduint32Optional
By default, the expiry time will be set to 1200 seconds (20 minutes), from the time the request was received.

If this field is filled, the order with the corresponding payment_reference_id in this request will expire after the specified time period (in seconds) and payment attempts to this payment_reference_id will fail.

Accepts up to:
  • 3600 seconds (60 minutes) in Malaysia and Singapore
  • 86400 seconds for Philippines
  • 172800 seconds (2 days) for Vietnam
  • 432000 seconds (5 days) for Indonesia and Thailand
Note: The system will return an error if both validity_period and expiry_time parameters are used simultaneously.
expiry_timeuint32Optional
Unix timestamp.

By default, the expiry time will be set to 1200 seconds (20 minutes), from the time the request was received.

If this field is filled, the order with the corresponding payment_reference_id in this request will expire after the specified timestamp and payment attempts to this payment_reference_id will fail.Accepts up to:
  • 3600 seconds (60 minutes) in Malaysia and Singapore
  • 86400 seconds for Philippines
  • 172800 seconds (2 days) for Vietnam
  • 432000 seconds (5 days) for Indonesia and Thailand
Note: The system will return an error if both validity_period and expiry_time parameters are used simultaneously.
promo_idsstringOptional
Comma separated eligible 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.
additional_infostringOptional
Additional information will be in json format.

  • This field supports up to 3 fields and needs to be sent in this format: {"field1":"{Data1}","field2":"{Data2}" ,"field3":"{Data3}"}
  • phonestringOptional
    Registered phone number of the customer on merchant's platform, to be provided with the country code and without the plus sign.

    Example:
    • An Indonesian phone number "82112345678" should be passed in as "6282112345678", with 62 being the country code.
    • A Vietnamese phone number "0981234567" should be passed in as "84981234567", with 84 being the country code.
    preferred_payment_method_typestringOptional
    Allow merchants to choose the preferred payment method for the payment order, where this payment method will be selected at customer's payment page. Accepted value:
    • ShopeePay = 'spp_wallet'
    • SPayLater = 'spay_later'

    Only for PH:
    • Maribank Direct Debit = 'maribank_direct_debit'

    Response Parameters

    request_idstring

    Unique identifier for request.

    errcodeint32

    Error code to specify the error returned.

    debug_msgstring

    Debug message to provide more information.

    redirect_url_httpstring

    Indicates the universal URL to ShopeePay's payment page. Merchant should not impose any domain whitelisting and IP restriction for this URL.

    qr_contentstring

    QR string in plain text.

    qr_urlstring

    URL to download QR image, URL is valid for 5 minutes.

    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.

    ValueDescription
    -2A server dropped the connection
    -1A server error occurred Please 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
    11Duplicated request
    15Payment amount exceeded payment limit
    50The Request Parameters is invalid due to payload sent is not a valid JSON
    627The Request Parameters is invalid due to promo ID exceeded limit
    1800A server error occurred
    1908Service is temporarily down for scheduled maintenance