Skip to content

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_idstringrequired

    The payment id against which refund is to be initiated

  • refund_idstring, nullable

    Unique 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, nullable

    The identifier for the Merchant Account

  • amountinteger, nullable

    Total 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, nullable

    Reason 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, or requested_by_customer

  • refund_typestring (enum), nullable

    To indicate whether to refund needs to be instant or scheduled

    Possible values: scheduled, instant

  • metadataobject, nullable

    You 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), nullable

    Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.

  • all_keys_requiredboolean, nullable

    If true, returns stringified processor raw response body

Responses

  • 200Refund created
  • 400Missing 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"
}