Refund a Payment
Refund a Payment
Use this endpoint to request a full refund or partial refund of a successful ShopeePay transaction.
- URL: "/v3/merchant-host/transaction/refund/create-new"
Types of Refund:
- Full Refund: a transaction's full amount
- Partial Refund: multiple (partial) amounts as long as the sum does not exceed the transaction's full amount. Merchant should wait for the previous partial refund to complete successfully before creating the next partial refund.
The refund expiration period is set at 365 days, starting from when the initial payment is made.
Calling Create Refund endpoint will return 2 status types:
- Success - transaction successfully refunded, customer can try paying again.
- Failed - transaction can be found but it does not meet the requirements for refund.
Note: Refund endpoint supports idempotent response. Multiple API requests using the same payload will only trigger the action once to prevent the risk of creating duplicate refunds.
Request Parameters
Unique identifier for request, accepts up to 64 characters.
payment_reference_id passed to ShopeePay when payment was created.Unique identifier of refund transaction generated by merchant.Accepts up to 64 characters.
Unique identifier of merchant in merchant system.
Unique identifier of store in merchant system.
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).
If merchant is on full refund and did not pass this parameter, the refund request will be processed as usual.
Response Parameters
Unique identifier for request.
Error code to specify the error returned.
Debug message to provide more information.
Will return empty list if no such transaction.
Will return empty if no co-funding involved. Note: This field is currently used in Thailand and Vietnam only.
- This field supports up to 3 fields and needs to be sent in this format: {"field1":"{Data1}","field2":"{Data2}" ,"field3":"{Data3}"}
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 field. 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 |
| 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 refund |
| 11 | Duplicated request |
| 42 | Insufficient balance |
| 304 | Unable to process refund due to payment exceeding refund validity period |
| 308 | Unable to process refund due to payment was made using non refundable voucher |
| 309 | Unable to process refund due to merchant does not have enough fee balance |
| 320 | Unable to process refund due to another ongoing refund request for the transaction |
| 321 | Unable to process refund due to insufficient balance |
| 401 | Unable to process refund due to requested refund amount exceeds transaction amount |
| 601 | Unable to process refund that does not meet the refund rules, such as: Refund operation is not allowed for the chosen merchant/store The transaction has already been refunded before Refund to a payment made by a different merchant/store is not allowed Refunds are not allowed during refund block periods, by default it is set at 12am to 5am based on the local time Please note that the listed reasons are not exhaustive. |
| 602 | Request to refund an unsuccessful payment transaction |
| 1302 | Unable to process refund due to insufficient balance |
| 1906 | Unable to process refund due to transaction has been failed |
| 1908 | Service is temporarily down for scheduled maintenance |
| 300226 | Unable to refund to cross border merchants |