curl --request POST \
--url https://api.{gr4vy_id}.gr4vy.app/payment-methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"method": "card",
"number": "4111111111111111",
"expiration_date": "11/25",
"external_identifier": "card-323444",
"buyer_id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"buyer_external_identifier": "user-789123",
"redirect_url": "https://example.com/callback"
}'
{
"type": "payment-method",
"id": "77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5",
"additional_schemes": [
"visa"
],
"approval_target": "any",
"approval_url": "https://api.example.app.gr4vy.com/payment-methods/ffc88ec9-e1ee-45ba-993d-b5902c3b2a8c/approve",
"buyer": {
"type": "buyer",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"billing_details": {
"type": "billing-details",
"first_name": "John",
"last_name": "Lunn",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "London",
"country": "GB",
"postal_code": "789123",
"state": "Greater London",
"state_code": "GB-LND",
"house_number_or_name": "10",
"line1": "10 Oxford Street",
"line2": "New Oxford Court",
"organization": "Gr4vy"
},
"tax_id": {
"value": "12345678931",
"kind": "gb.vat"
}
},
"created_at": "2013-07-16T19:23:00.000+00:00",
"display_name": "John L.",
"external_identifier": "user-789123",
"merchant_account_id": "default",
"updated_at": "2013-07-16T19:23:00.000+00:00"
},
"country": "US",
"created_at": "2013-07-16T19:23:00.000+00:00",
"currency": "USD",
"details": {
"card_type": "credit",
"bin": "412345"
},
"expiration_date": "07/24",
"external_identifier": "user-789123",
"has_replacement": false,
"label": "john@example.com",
"last_replaced_at": "2023-07-26T19:23:00.000+00:00",
"merchant_account_id": "default",
"method": "card",
"mode": "card",
"scheme": "visa",
"status": "succeeded",
"updated_at": "2013-07-16T19:23:00.000+00:00",
"fingerprint": "20eb353620155d2b5fc864cc46a73ea77cb92c725238650839da1813fa987a17"
}
Stores and vaults a new payment method.
Vaulting a card only stores its information but doesn’t validate it against any PSP, so ephemeral data like the security code, often referred to as the CVV or CVD, won’t be used. In order to validate the card data, a CIT (Customer Initiated Transaction) must be done, even if it’s a zero-value one.
curl --request POST \
--url https://api.{gr4vy_id}.gr4vy.app/payment-methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"method": "card",
"number": "4111111111111111",
"expiration_date": "11/25",
"external_identifier": "card-323444",
"buyer_id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"buyer_external_identifier": "user-789123",
"redirect_url": "https://example.com/callback"
}'
{
"type": "payment-method",
"id": "77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5",
"additional_schemes": [
"visa"
],
"approval_target": "any",
"approval_url": "https://api.example.app.gr4vy.com/payment-methods/ffc88ec9-e1ee-45ba-993d-b5902c3b2a8c/approve",
"buyer": {
"type": "buyer",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"billing_details": {
"type": "billing-details",
"first_name": "John",
"last_name": "Lunn",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "London",
"country": "GB",
"postal_code": "789123",
"state": "Greater London",
"state_code": "GB-LND",
"house_number_or_name": "10",
"line1": "10 Oxford Street",
"line2": "New Oxford Court",
"organization": "Gr4vy"
},
"tax_id": {
"value": "12345678931",
"kind": "gb.vat"
}
},
"created_at": "2013-07-16T19:23:00.000+00:00",
"display_name": "John L.",
"external_identifier": "user-789123",
"merchant_account_id": "default",
"updated_at": "2013-07-16T19:23:00.000+00:00"
},
"country": "US",
"created_at": "2013-07-16T19:23:00.000+00:00",
"currency": "USD",
"details": {
"card_type": "credit",
"bin": "412345"
},
"expiration_date": "07/24",
"external_identifier": "user-789123",
"has_replacement": false,
"label": "john@example.com",
"last_replaced_at": "2023-07-26T19:23:00.000+00:00",
"merchant_account_id": "default",
"method": "card",
"mode": "card",
"scheme": "visa",
"status": "succeeded",
"updated_at": "2013-07-16T19:23:00.000+00:00",
"fingerprint": "20eb353620155d2b5fc864cc46a73ea77cb92c725238650839da1813fa987a17"
}
payment-methods.write
scope.Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Details to register a new card payment method.
Returns the created payment method.
A generic payment method.
Was this page helpful?