Refund Payment
POSThttps://api.cleverhub.co/api/v1/payment_requests/refund
Initiate a refund request on a completed payment with a received
status. This endpoint processes a refund using the available balance in your account. If there is insufficient balance, you will either receive a top-up notification or need to wait for additional funds from new payments (Payins) to complete the refund.
Refunds can be partial or full, depending on the refund_amount
specified. A reason for the refund is required for tracking and documentation purposes.
Request
- application/json
Bodyrequired
The unique identifier for the original payment request that is to be refunded.
1
The amount to be refunded. If this is not specified, the refund will default to the total original payment amount.
100
The reason for the refund, which must be at least 5 characters long. This is required for record-keeping and can help in cases of partial refunds.
Partial refund due to customer request
Responses
- 200
- 400
- 401
- 422
Refund initiated successfully.
- application/json
- Schema
- Example (auto)
Schema
The PayID to which the refund amount should be paid to complete the refund process.
refund_payid@example.com
The total amount that was refunded.
100
The reason provided for the refund.
Partial refund due to customer request
payment_request object
{
"refund_payid": "refund_payid@example.com",
"refund_amount": 100,
"reason": "Partial refund due to customer request",
"payment_request": {
"id": 123456,
"balance_id": "HDCHJSS",
"name": "John Doe",
"request_payid": "payid123@example.com",
"merchant_name": "Merchant Co.",
"gst": true,
"amount": "100.0",
"total": "110.0",
"gst_amount": "10.0",
"expired_at": "2024-12-31T23:59:59Z",
"external_id": "custom-id-12345",
"cashback_amount": "5.0",
"pay_by": "2024-12-30T23:59:59Z",
"paid_at": "2024-12-25T12:34:56Z",
"status": "pending",
"description": "Payment for invoice #1234",
"nonce": "unique_nonce_string",
"stage": "overpaid",
"refund_information": {
"refund_payid": "sample@payid.com",
"refund_amount": 0.1,
"request_date": "2024-12-31T23:59:59Z",
"reason": "Broken product"
},
"sender_details": {
"reference": "SenderRef123",
"description": "Payment from John Doe",
"bsb": "123456",
"account_number": "987654321",
"account_name": "John Doe"
}
}
}
Bad Request
Unauthorized
Unprocessable Entity
Authorization: app-id
name: app-idtype: apiKeyin: headerdescription: A unique identifier assigned to each application.
name: secret-keytype: apiKeyin: headerdescription: A secure token associated with the `app-id`.
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.cleverhub.co/api/v1/payment_requests/refund");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("app-id", "<app-id>");
request.Headers.Add("secret-key", "<app-id>");
var content = new StringContent("{\n \"payment_request_id\": 1,\n \"refund_amount\": 100,\n \"reason\": \"Partial refund due to customer request\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());