Gravv docs
Docs Agent Sign in Get API keys

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.

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.

POSThttps://api.gravv.xyz/v1/collections/cards/payment-intents/charge

Headers

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.

Optional ID of the payer's device. On a payment intent, Gravv stores it and reuses it for later saved-card charges.

Request Body

The intent_id, with its pi_ prefix

A card token saved under the intent's client_customer_id

E.164 format

YYYY-MM-DD, MM/DD/YYYY or DD/MM/YYYY

Checked against the billing country

ISO 3166-1 alpha-2

Request Examples

{
"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"
}

Responses

Status Description
200 The charge went through, or 3D Secure is needed. For requires_action, send the payer to next_action_url.
400 The charge failed or was declined. Read the decline code from GET /v1/collections/{id} or the failed webhook.

200 response

Possible values: succeeded, requires_action

Collection ID. Left out when 3D Secure is needed.

Possible values: redirect_to_url

The 3D Secure page to send the payer to

{
"data": {
"transaction_id": "90950347-d40b-4ab9-aa77-f1882750477c",
"payment_intent_id": "pi_429f578b-675a-4b68-abe3-856cd976257f",
"status": "succeeded"
},
"error": null
}

400 response

{
"data": null,
"error": "The card has insufficient funds: payment declined"
}

Authorization

  • ApiKeyAuth
Was this page helpful?
ESC