Skip to content

Refund a payment

POST
/api/v1/payments/{id}/refund
curl --request POST \
--url https://digize.com/api/v1/payments/example/refund \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \
--header 'x-api-key: <x-api-key>' \
--data '{ "amount": 1, "reason": "example" }'

Gives money back to the card that paid an invoice, deposit, payment link or subscription charge: amount of it, or all that’s left. A store order’s payment is refunded with commerce.orders.refund.

Needs the crm:write permission. It can’t be undone.

id
required
string
>= 1 characters <= 64 characters
Idempotency-Key
string
>= 1 characters <= 255 characters

Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.

Example

5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69
Media typeapplication/json
object
amount

In the workspace currency’s minor unit: 2000 is $20.00.

integer
<= 100000000
reason
Any of:
string
<= 300 characters

Example generated

{
"amount": 1,
"reason": "example"
}

Done

Media typeapplication/json
object
id
required
string
stripeId
required

The Stripe PaymentIntent, or a subscription charge’s Stripe invoice.

string
source
required
string
Allowed values: order invoice deposit subscription payment_link
description
required
string
contact
required
object
id
required

The contact’s id.

string
name
required
string
email
required
string
amount
required

In the workspace currency’s minor unit: 2000 is $20.00.

integer
<= 100000000
refunded
required

In the workspace currency’s minor unit: 2000 is $20.00.

integer
<= 100000000
fee
required

Stripe’s fee, once Stripe reported it.

number | null
method
required
Any of:
object
brand
required
string
last4
required
string
wallet
required
Any of:
string
Allowed values: apple_pay google_pay
status
required
string
Allowed values: succeeded partially_refunded refunded failed disputed
failure
required
string | null
createdAt
required
string format: date-time
orderId
required

A store order’s payment: refund it with commerce.orders.refund.

string | null

Example

{
"source": "order",
"method": {
"wallet": "apple_pay"
},
"status": "succeeded"
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

A request with the same Idempotency-Key is still running (conflict).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The Idempotency-Key was used with a different request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}