Version: Beta

Associate a card to a buyer

It is possible to bind a tokenized card to a buyer when it is being created. There are a few ways to do so.

Associate by buyer_id#

The easiest way to associate a buyer to a card is to pass along a buyer_id when creating a card.

This will find a buyer with that id and associate the card to it. If a buyer with that id could not be found it's ignored.

curl -i -X POST "https://api.{gr4vyId}.gr4vy.app/payment-methods" \
-H "Authorization: Bearer [JWT_TOKEN]" \
-H "Content-Type: application/json" \
-d '{
"method": "card",
"number": "4111111111111111",
"expiration_date": "11 / 22",
"security_code": "123",
"buyer_id": "fe26475d-ec3e-4884-9553-f7356683f7f9"
}'

Associate by buyer_external_identifier#

Alternatively, a card can be associated to a buyer by it's external_identifier. If a buyer with that external_identifier could not be found it's ignored.

curl -i -X POST "https://api.{gr4vyId}.gr4vy.app/payment-methods" \
-H "Authorization: Bearer [JWT_TOKEN]" \
-H "Content-Type: application/json" \
-d '{
"method": "card",
"number": "4111111111111111",
"expiration_date": "11 / 22",
"security_code": "123",
"buyer_external_identifier": "412231123"
}'