Globagift Docs
API / Developers

Distribution

Distributor keys: granted merchants, catalogues, reservations, capture and statements.

GET
/v1/distribution/grants

Requires a distributor key with distribution:read or distribution:sell scope. Lists the merchants this distributor may currently sell for. Only active grants over active merchants are returned, so a revoked grant disappears immediately. Returns the merchant id and display name only.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Response Body

Granted merchants

application/json
  1. response
data*array<>
Example Request
curl -X GET 'https://engine-sandbox.globagift.io/v1/distribution/grants'
Example Response
{  "data": [    {      "merchant_id": "500924a8-3f5e-4c00-beb8-2efcde988aea",      "name": "string"    }  ]}
GET
/v1/distribution/products

Requires a distributor key with distribution:read or distribution:sell scope. Returns a uniform 404, identical to a merchant that does not exist, when the distributor has no active grant for merchant_id. Only active products are returned; draft, paused and archived products are never disclosed to a distributor.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Query Parameters

merchant_id*string

Response Body

Card products

application/json
  1. response
data*array<>
total?integer
Range0 <= value
limit?integer
Range1 <= value <= 100
offset?integer
Range0 <= value <= 1000000
Example Request
curl -X GET 'https://engine-sandbox.globagift.io/v1/distribution/products?merchant_id=string'
Example Response
{  "data": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "currency": "EUR",      "denominations": [        1      ],      "min_amount": 0,      "max_amount": 0,      "expiry_months": 1,      "status": "draft",      "paused_reason": "string",      "active_design_id": "a4eee967-4c43-4a0e-ab43-626b7bf7880b",      "artwork_url": "http://example.com"    }  ],  "total": 0,  "limit": 1,  "offset": 0}
POST
/v1/distribution/reservations

Requires a distributor key with distribution:sell scope and an Idempotency-Key header. Idempotency keys are scoped to the calling distributor. Retrying with the same key and payload returns the original reservation; the same key with a different payload returns 409 idempotency_key_conflict. Send your own order_reference so the sale can be looked up later. ttl_seconds is capped at 3600.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Header Parameters

Idempotency-Key*string
Length1 <= length <= 255

Request Body

application/json
  1. body
merchant_id*string
Formatuuid
card_product_id*string
Formatuuid
amount*integer

Integer minor units; for example 1250 means EUR 12.50.

Range1 <= value <= 1000000000000
currency*string
Match^[A-Za-z]{3}$
order_reference?string

Your own order or sale reference, unique per distributor. If omitted, a reference is generated.

Length1 <= length <= 255
ttl_seconds?integer

How long the float stays held before it is released automatically.

Range1 <= value <= 3600
Default900

Response Body

Reservation held

application/json
  1. response
id*string
Formatuuid
order_reference*string
status*string
Value in"held""captured""released""expired"
amount*integer

Integer minor units; for example 1250 means EUR 12.50.

Range0 <= value
currency*string
Match^[A-Z]{3}$
expires_at*string
Formatdate-time
created_at*string
Formatdate-time
settled_at*|null
card_id*|null
Example Request
curl -X POST 'https://engine-sandbox.globagift.io/v1/distribution/reservations' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "merchant_id": "500924a8-3f5e-4c00-beb8-2efcde988aea",  "card_product_id": "61f1cb74-007e-466f-97a9-d7820aabc97f",  "amount": 1,  "currency": "EUR"}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "order_reference": "string",  "status": "held",  "amount": 0,  "currency": "EUR",  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "settled_at": "2019-08-24T14:15:22Z",  "card_id": "66f6e46c-f6a1-4af8-a1bd-49666bc01304"}
GET
/v1/distribution/orders/{order_reference}

Requires distribution:read or distribution:sell scope. Returns the distributor's own reservation status, timestamps, amount, currency, reservation id and card id. Unknown references and references belonging to another distributor return the same uniform 404.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Path Parameters

order_reference*string
Length1 <= length <= 255

Response Body

Distributor order reservation

application/json
  1. response
id*string
Formatuuid
order_reference*string
status*string
Value in"held""captured""released""expired"
amount*integer

Integer minor units; for example 1250 means EUR 12.50.

Range0 <= value
currency*string
Match^[A-Z]{3}$
expires_at*string
Formatdate-time
created_at*string
Formatdate-time
settled_at*|null
card_id*|null
Example Request
curl -X GET 'https://engine-sandbox.globagift.io/v1/distribution/orders/string'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "order_reference": "string",  "status": "held",  "amount": 0,  "currency": "EUR",  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "settled_at": "2019-08-24T14:15:22Z",  "card_id": "66f6e46c-f6a1-4af8-a1bd-49666bc01304"}
POST
/v1/distribution/reservations/{id}/capture

Requires distribution:sell scope. Unknown reservation ids, reservations belonging to another distributor, and reservations whose merchant grant has since been revoked all return the same uniform 404. Replayable: capturing an already-captured reservation returns 200 with the same reservation and card again, so a lost response is recoverable. The claim code is returned only on the first successful capture and is never returned again, so store it before acknowledging the sale.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Path Parameters

id*string

Response Body

Reservation captured; card and claim code included. On a replayed capture the same card is returned without a claim code.

application/json
  1. response
reservation*
card*
Example Request
curl -X POST 'https://engine-sandbox.globagift.io/v1/distribution/reservations/string/capture'
Example Response
{  "reservation": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "order_reference": "string",    "status": "held",    "amount": 0,    "currency": "EUR",    "expires_at": "2019-08-24T14:15:22Z",    "created_at": "2019-08-24T14:15:22Z",    "settled_at": "2019-08-24T14:15:22Z",    "card_id": "66f6e46c-f6a1-4af8-a1bd-49666bc01304"  },  "card": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "state": "created",    "currency": "EUR",    "amount": 0,    "claim_code": "string",    "redemption_code": "string",    "payment_reference": "string",    "acceptance_point_id": "cb7fe03a-d13a-4fa6-9fe2-dcdbba794774",    "whatsapp_delivery": {      "sent": true,      "to_masked": "string",      "reason": "string"    },    "email_delivery": {      "sent": true,      "to_masked": "string",      "reason": "string"    },    "redemption_code_last4": "stri",    "expires_at": "2019-08-24T14:15:22Z",    "card_design_id": "e9676ab8-4ee1-4a63-b3d4-c9176075bb1b",    "artwork_url": "http://example.com",    "balance": 0,    "issued_at": "2019-08-24T14:15:22Z",    "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe"  }}
DELETE
/v1/distribution/reservations/{id}

Requires distribution:sell scope. Unknown reservation ids and reservations belonging to another distributor both return the same uniform 404.

Retries: not idempotent. After an unclear failure, read the current state before trying again.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Path Parameters

id*string

Response Body

Reservation released

Example Request
curl -X DELETE 'https://engine-sandbox.globagift.io/v1/distribution/reservations/string'
Example Response
Empty
GET
/v1/distribution/statements

Requires distribution:read or distribution:sell scope. One row per ledger posting against the caller's own float in currency, oldest first, covering both the available and reserved balances. Only the calling distributor's own activity is returned. Each line names the balance it affected (available or reserved) and, where applicable, the reservation id and card id, so a reserve's two equal-and-opposite rows are distinguishable and every line ties back to a sale. A prefund has neither and reads null on both.

Authorization

distributorAuth
headerAuthorizationBearer <token>

A distributor key (ggd_...). Separate from merchant keys; it acts for the distributor, not for a merchant.

Query Parameters

currency*string
Length3 <= length <= 3
from?string

Inclusive date/time boundary for the resource timestamp named by this parameter.

Formatdate-time
to?string

Inclusive date/time boundary for the resource timestamp named by this parameter.

Formatdate-time

Response Body

Statement lines

application/json
  1. response
data*array<>
Example Request
curl -X GET 'https://engine-sandbox.globagift.io/v1/distribution/statements?currency=str'
Example Response
{  "data": [    {      "entry_type": "string",      "amount_minor": 0,      "at": "2019-08-24T14:15:22Z",      "pocket": "available",      "reservation_id": "b947feb5-3593-40ee-8244-4428da3fe32d",      "card_id": "66f6e46c-f6a1-4af8-a1bd-49666bc01304"    }  ]}