Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Collections Refund a collection

Refund a collection

Refunds a card collection to the payer's card. Only card collections (`card`, `apple_pay` and `google_pay`) can be refunded, and only once their `transaction_status` is `completed`. Each collection takes one refund. Leave out `amount_cents` to refund the whole payment, or send less for a partial refund. A partial refund still uses up the one refund.

POSThttps://api.gravv.xyz/v1/collections/{id}/refundTry it
Api-Key

Refunds a card collection to the payer's card. Only card collections (card, apple_pay and google_pay) can be refunded, and only once their transaction_status is completed. Each collection takes one refund. Leave out amount_cents to refund the whole payment, or send less for a partial refund. A partial refund still uses up the one refund.

A pending refund finishes later. Gravv then sends collection.status.refunded, or collection.status.failed with onramp_status refund_failed. Gravv also sends collection.status.refund_pending or collection.status.refunded as soon as you call this endpoint.

Path parameters

NameDescription
id:stringRequired
The collection's transaction_id

Headers

NameDescription
Idempotency-Key:stringRequired
Required for POST requests. Reuse it only to retry the same request. Gravv stores a 400 with the key for 24 hours, so use a new key after you fix a rejected body.

Body parameters

NameDescription
amount_cents:integer
The amount to refund, in US cents. Leave it out to refund the whole payment. Send less than the payment for a partial refund.
reason:string
Why you are refunding the payment

Response

Returns 200 OK. The refund started

NameDescription
data:object
Show 4 child attributesobject
error:null

Errors

StatusMeaning
200The refund started
400The refund was refused. A collection that is not completed, or that already has a refund, returns cannot perform 'refund_collection' in state '<status>': …. When the refund is declined, the collection moves to refund_failed and Gravv sends collection.status.failed. Retry it with the refund_id from List refunds. If List refunds shows no refund, contact Gravv support.
Was this page helpful? Yes No
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refund' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: order_789_attempt_1' \
--header 'Content-Type: application/json' \
--data '{
"reason": "Order cancelled"
}'
Responseapplication/json
200400OK
{
"data": {
"success": true,
"transaction_id": "07b655cc-3dbd-4f6c-a16c-4657946d2e08",
"refund_id": "8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34",
"status": "pending"
},
"error": null
}