Endpoint
POST /payment-method/{id}/payment/{paymentId}/refund
Authentication
Include your API key in the request headers:Path Parameters
The unique identifier of the payment method (UUID).
The unique identifier of the payment to refund (UUID).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | No | Reason for the refund. Useful for accounting and auditing purposes. |
Response
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier of the payment. |
status | string | Payment status after refund (REFUNDED). |
amount | number | The refunded amount. |
currency | string | Currency code. |
Code Examples
The entire original charge amount will be refunded.Refund Rules
Refunds are permanent. Once a refund is processed, it cannot be reversed. The payment status changes to
REFUNDED.Error Handling
| Status Code | Error | Solution |
|---|---|---|
| 400 | Payment not CONFIRMED | Only payments with CONFIRMED status can be refunded. |
| 401 | Unauthorized | Check your API key is valid and included in headers. |
| 404 | Payment method not found | Verify the payment method ID is correct. |
| 404 | Payment not found | Verify the payment ID is correct. |
Best Practices
Verify Payment Status Before Refunding
Verify Payment Status Before Refunding
Always check that the payment status is
CONFIRMED before attempting a refund to avoid unnecessary API errors.Track Refund Reasons
Track Refund Reasons
Always include a
reason field when processing refunds. This helps with accounting, auditing, and customer service.Implement Idempotent Refund Logic
Implement Idempotent Refund Logic
Protect against duplicate refund requests by checking if the payment has already been refunded before making the API call.
Communicate Refund Timelines to Customers
Communicate Refund Timelines to Customers
Refund processing times depend on the customer’s bank. Let customers know that while the refund is processed immediately on Compago’s side, it may take a few business days to appear on their statement.
Next Steps
Manage Payment Methods
List, retrieve, and revoke saved payment methods.
Payment Methods Overview
Review payment method statuses, use cases, and how the feature works.