Skip to main content
POST
/
v1
/
refunds
Create a Refund
curl --request POST \
  --url https://api.leanrails.com/v1/refunds \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --data '
{
  "payment_intent": "<string>",
  "amount": 2,
  "reason": "<string>",
  "metadata": {}
}
'
{
  "id": "ref_xxx",
  "object": "refund",
  "amount": 1000,
  "currency": "usd",
  "payment_intent": "pi_xxx",
  "status": "succeeded",
  "created": 1234567890,
  "livemode": false,
  "charge": "ch_xxx",
  "reason": "<string>",
  "metadata": {}
}

Authorizations

Authorization
string
header
required

Use your secret API key as the username with an empty password.

Headers

Idempotency-Key
string
required

Unique key to ensure idempotent requests.

Maximum string length: 255
X-API-Version
string

Override the API version for this request.

Body

application/json
payment_intent
string
required

ID of the PaymentIntent to refund.

amount
integer

Amount to refund. Defaults to the full amount.

Required range: x >= 1
reason
string

Reason for the refund.

Maximum string length: 1000
metadata
object

Set of key-value pairs for storing additional information.

Response

The created Refund.

id
string
required
Example:

"ref_xxx"

object
enum<string>
required
Available options:
refund
amount
integer
required
Example:

1000

currency
string
required
Example:

"usd"

payment_intent
string
required
Example:

"pi_xxx"

status
enum<string>
required
Available options:
succeeded,
pending,
failed
created
integer
required
Example:

1234567890

livemode
boolean
required
Example:

false

charge
string | null
Example:

"ch_xxx"

reason
string | null
metadata
object

Set of key-value pairs for storing additional information.