Refund Sale
Last updated: 04-Jan-2022
Rate this article:
Refund Invoice
The refund_invoice call is used to attempt to issue a full or partial refund on an invoice. This call will send the REFUND_ISSUED INS message.
URL: https://www.2checkout.com/api/sales/refund_invoice
HTTP Method: POST
Input Parameters
| Parameter | Description |
|---|---|
| sale_id | Order number/sale ID to issue a refund on. Optional when invoice_id is specified, otherwise required. |
| invoice_id | Invoice ID to issue a refund on. Optional when sale_id is specified and sale only has 1 invoice. |
| amount | The amount to refund. Only needed when issuing a partial refund. If an amount is not specified, the remaining amount for the invoice is assumed. |
| currency | Currency type of refund amount. Can be ‘usd’, ‘vendor’ or ‘customer’. Only required if amount is used. |
| comment | Message explaining why the refund was issued. Required. May not contain ‘<’ or ‘>’. (5000 character max) |
| category | ID representing the reason the refund was issued. Required. (values: 1-17 from the following list can be used except for 7 as it is for internal use only) |
| ID | Description |
|---|---|
| 1 | Did not receive order |
| 2 | Did not like item |
| 3 | Item(s) not as described |
| 4 | Fraud |
| 5 | Other |
| 6 | Item not available |
| 7 | Do Not Use (Internal use only) |
| 8 | No response from merchant |
| 9 | Recurring last installment |
| 10 | Cancellation |
| 11 | Billed in error |
| 12 | Prohibited product |
| 13 | Service refunded at merchants request |
| 14 | Non delivery |
| 15 | Not as described |
| 16 | Out of stock |
| 17 | Duplicate |
Data Returned
| Parameter | Description |
|---|---|
| response_code | Tells the user whether or not the operation was successful |
| response_message | Tells the user why the operation was or was not successful |
Example API Call
curl -X POST https://www.2checkout.com/api/sales/refund_invoice \
-u 'username:password' -d 'sale_id=1234567890' -d 'amount=1.00' \
-d 'currency=true' -d 'category=13' -H 'Accept: application/json' \
-d 'comment=Buyer deserved a refund.'Example Successful Response
{
"response_code" : "OK",
"response_message" : "refund added to invoice"
}Common Error Codes
| Code | Description |
|---|---|
| PARAMETER_MISSING | Required parameter missing: |
| PARAMETER_INVALID | Invalid value for parameter: |
| RECORD_NOT_FOUND | Unable to find record. |
| FORBIDDEN | Access denied to sale. |
Method-Specific Error Codes
| Code | Description |
|---|---|
| FORBIDDEN | Permission denied to set refund category to 7. |
| FORBIDDEN | Access denied to invoice. |
| AMBIGUOUS | Ambiguous request. Multiple invoices on sale. invoice_id parameter required. |
| TOO_LOW | Amount must be at least 0.01. |
| NOTHING_TO_DO | Invoice was already refunded. |
| TOO_HIGH | Amount greater than remaining balance on invoice. |
| TOO_LATE | Invoice too old to refund. (Will occur if sale is over 180 days) |
Rate this article: