Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Collections Charge card

Charge card

Charges a saved card against an open payment intent, server to server. Use it for repeat charges after the payer saved a card. The card must be saved under the intent's `client_customer_id`.

POSThttps://api.gravv.xyz/v1/collections/cards/payment-intents/chargeTry it
Api-Key

Charges a saved card against an open payment intent, server to server. Use it for repeat charges after the payer saved a card. The card must be saved under the intent's client_customer_id.

You can charge a saved card at most 5 times in 24 hours, and each charge can be at most 3 times the card's first payment. A declined charge returns HTTP 400 with a sentence such as The card has insufficient funds: payment declined.

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.
X-Device-Id:string
Optional ID of the payer's device. On a payment intent, Gravv stores it and reuses it for later saved-card charges.

Body parameters

NameDescription
payment_intent_id:stringRequired
The intent_id, with its pi_ prefix
card_token:stringRequired
A card token saved under the intent's client_customer_id
first_name:string
last_name:string
email:string
phone_number:string
E.164 format
date_of_birth:string
YYYY-MM-DD, MM/DD/YYYY or DD/MM/YYYY
billing_address1:string
billing_city:string
billing_state:string
billing_zip:string
Checked against the billing country
billing_country:string
ISO 3166-1 alpha-2

Response

Returns 200 OK. The charge went through, or 3D Secure is needed. For requires_action, send the payer to next_action_url.

NameDescription
data:object
Show 6 child attributesobject
error:null

Errors

StatusMeaning
200The charge went through, or 3D Secure is needed. For requires_action, send the payer to next_action_url.
400The charge failed or was declined. Read the decline code from GET /v1/collections/{id} or the failed webhook.
Was this page helpful? Yes No
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/collections/cards/payment-intents/charge' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: order_789_attempt_1' \
--header 'X-Device-Id: device-7f3a9c' \
--header 'Content-Type: application/json' \
--data '{
"payment_intent_id": "pi_429f578b-675a-4b68-abe3-856cd976257f",
"card_token": "tokn_80aebb6ea2594a74bc",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"billing_address1": "123 Market St",
"billing_city": "San Francisco",
"billing_state": "CA",
"billing_zip": "94105",
"billing_country": "US"
}'
Responseapplication/json
200400OK
{
"data": {
"transaction_id": "90950347-d40b-4ab9-aa77-f1882750477c",
"payment_intent_id": "pi_429f578b-675a-4b68-abe3-856cd976257f",
"status": "succeeded"
},
"error": null
}