Version: 1.0.0

Add a buyer

You can add a buyer by calling the POST /buyers API. The call accepts an optional external_identifier (for example the user's email, username, or a database ID) and an optional display_name which will be shown in the admin panel.

Top tip

There is no need create a buyer first before creating a transaction. A buyer can be automatically created and associated when a transaction is made.

curl -i -X POST "https://api.{gr4vyId}.gr4vy.app/buyers" \
-H "Authorization: Bearer [JWT_TOKEN]" \
-H "Content-Type: application/json" \
-d '{
"display_name": "John L.",
"external_identifier": "412231123"
}'
note

A buyer can be created without any external_identifier and display_name. In that case the buyer only serves as a way to link stored payments methods to a user ID. In this case you will need to keep track of the buyer's ID in your own database to link it back to a user record.

The API returns a new buyer resource.

POST /buyers
{
"type": "buyer",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"external_identifier": "412231123",
"display_name": "John L.",
"created_at": "2013-07-16T19:23:00.000Z",
"updated_at": "2013-07-16T19:23:00.000Z"
}