Refunds: Create
POST/refunds
Creates a refund against an already processed payment. In case of some processors, you can even opt to refund only a partial amount multiple times until the original charge amount has been refunded
Request body RefundRequest (object)
payment_idstringrequiredThe payment id against which refund is to be initiated
refund_idstring, nullableUnique Identifier for the Refund. This is to ensure idempotency for multiple partial refunds initiated against the same payment. If this is not passed by the merchant, this field shall be auto generated and provided in the API response. It is recommended to generate uuid(v4) as the refund_id.
merchant_idstring, nullableThe identifier for the Merchant Account
amountinteger, nullableTotal amount for which the refund is to be initiated. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc., If not provided, this will default to the full payment amount
reasonstring, nullableReason for the refund. Often useful for displaying to users and your customer support executive. In case the payment went through Stripe, this field needs to be passed with one of these enums:
duplicate,fraudulent, orrequested_by_customerrefund_typestring (enum), nullableTo indicate whether to refund needs to be instant or scheduled
Possible values:
scheduled,instantmetadataobject, nullableYou can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
split_refundsSplitRefund (one of object | object | object), nullableCharge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.
all_keys_requiredboolean, nullableIf true, returns stringified processor raw response body
Responses
200Refund created400Missing Mandatory fields
Request
curl --request POST \
--url https://sandbox.cardencer.com/refunds \
--header 'Content-Type: application/json' \
--header 'api-key: snd_...' \
--data '{
"amount": 654,
"payment_id": "{{payment_id}}",
"refund_type": "instant"
}'Response
{
"refund_id": "string",
"payment_id": "string",
"amount": 6540,
"currency": "string",
"status": "succeeded"
}{
"error_type": "invalid_request",
"message": "Missing required param: {param}",
"code": "IR_04"
}