# Distributor marketplace

Source: https://docs.globagift.io/docs/api/distributor
Description: Use the Globagift distributor API to list the merchants you may sell for, show their gift card products, reserve prefunded float, issue cards and reconcile from statements.


A distributor sells gift cards for many merchants through its own marketplace, app or rewards platform. The distributor sells to its customers in its own name, pays for cards from its own prefunded balance, and delivers the cards it issues.

## How it works [#how-it-works]

1. **Onboarding.** Globagift sets up your distributor account and issues your `ggd_` key.
2. **Grants.** Each merchant you sell for is granted to you individually. You only see and sell what you are granted.
3. **Prefunding.** You fund a float with Globagift by bank transfer. Your float is credited when the funds arrive.
4. **Selling.** For each sale, reserve float, take your customer's payment, then capture the reservation to issue the card.
5. **Reconciling.** Statements list every movement on your float.

Steps 1 to 3 are arranged with Globagift. There are no API endpoints that create distributors, grant merchants or add float.

## Build your catalogue [#build-your-catalogue]

List the merchants you can currently sell for:

```bash
curl -s "$GG_BASE/v1/distribution/grants" -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY"
```

```json
{ "data": [{ "merchant_id": "3f0c2b1e-8d4a-4c55-9a1e-6b2d7e9f1a20", "name": "Example Merchant" }] }
```

Then list each merchant's products:

```bash
curl -s "$GG_BASE/v1/distribution/products?merchant_id=3f0c2b1e-8d4a-4c55-9a1e-6b2d7e9f1a20" \
  -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY"
```

Each product gives its name, currency, amount range or fixed denominations, expiry period and artwork URL when one is set. Only active products are listed.

Refresh your catalogue regularly. A merchant disappears from the grants list as soon as its grant is revoked, and a product disappears when the merchant pauses or archives it. A merchant that is not granted to you returns the same `404` as one that does not exist.

## Sell a card [#sell-a-card]

### 1. Reserve float [#1-reserve-float]

Reserve before you take your customer's payment. A reservation moves the amount from your available float to your reserved float, so two sales can never spend the same money.

```bash
curl -s -X POST "$GG_BASE/v1/distribution/reservations" \
  -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: mkt-order-5531" \
  -d '{
    "merchant_id": "3f0c2b1e-8d4a-4c55-9a1e-6b2d7e9f1a20",
    "card_product_id": "7a9e4c12-5b3d-4f8e-a6c1-2d9b0e7f4c35",
    "amount": 2000,
    "currency": "EUR",
    "order_reference": "mkt-order-5531",
    "ttl_seconds": 900
  }'
```

```json
{
  "id": "RESERVATION_ID",
  "order_reference": "mkt-order-5531",
  "status": "held",
  "amount": 2000,
  "currency": "EUR",
  "expires_at": "2026-11-04T10:40:00.000Z",
  "created_at": "2026-11-04T10:25:00.000Z",
  "settled_at": null,
  "card_id": null
}
```

- Always send your own `order_reference`. It is unique for your account and lets you find the sale later.
- `ttl_seconds` sets how long the hold lasts: 900 seconds by default, at most 3600. When it passes, the reservation expires and the float returns to your available balance.
- If your available float is too low, the request fails with `422` and code `insufficient_float`. Top up your float; retrying will not help.

### 2. Capture and issue [#2-capture-and-issue]

When your customer's payment succeeds, capture the reservation:

```bash
curl -s -X POST "$GG_BASE/v1/distribution/reservations/RESERVATION_ID/capture" \
  -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY"
```

```json
{
  "reservation": { "id": "RESERVATION_ID", "status": "captured", "amount": 2000, "currency": "EUR", "card_id": "CARD_ID" },
  "card": { "id": "CARD_ID", "state": "active", "currency": "EUR", "amount": 2000, "claim_code": "CLAIM_CODE" }
}
```

The claim code is returned **only on the first successful capture**. Store it, then deliver it to your customer. Capture is safe to repeat: a repeat returns the same reservation and card, without the claim code.

Your customer, or the person they give the card to, claims it to reveal the redemption code they spend with the merchant. See [Build a claim page](/docs/api/cards#build-a-claim-page).

### 3. Or release it [#3-or-release-it]

If the payment fails or the customer abandons checkout, release the reservation so the float returns straight away:

```bash
curl -s -X DELETE "$GG_BASE/v1/distribution/reservations/RESERVATION_ID" \
  -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY"
```

A `204` means the float is available again. Captured, released and expired reservations cannot be released.

## Recover a sale [#recover-a-sale]

If a request times out, look the sale up by your own reference:

```bash
curl -s "$GG_BASE/v1/distribution/orders/mkt-order-5531" -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY"
```

The response gives the reservation id, status, amount, currency, timestamps and card id when one has been issued. Then:

| Status | What to do |
| --- | --- |
| `held` | Capture it if payment succeeded, or release it |
| `captured` | The card was issued. If you did not store the claim code, contact Globagift support. |
| `released` or `expired` | Reserve again for a new attempt |

## Reconcile [#reconcile]

Statements are built from the ledger and cover only your own float:

```bash
curl -s "$GG_BASE/v1/distribution/statements?currency=EUR&from=2026-11-01&to=2026-11-30" \
  -H "Authorization: Bearer $GG_DISTRIBUTOR_KEY"
```

```json
{
  "data": [
    { "entry_type": "distribution_reserve", "amount_minor": -2000, "at": "2026-11-04T10:25:00.000Z", "pocket": "available", "reservation_id": "RESERVATION_ID", "card_id": null }
  ]
}
```

- `pocket` is `available` or `reserved`. A reservation shows as two equal and opposite lines, one in each pocket.
- `amount_minor` is signed: positive is value arriving in that pocket, negative is value leaving it.
- Lines run oldest first. `reservation_id` and `card_id` tie each line to a sale; a prefund has neither.

## Errors to handle [#errors-to-handle]

| Response | Meaning | What to do |
| --- | --- | --- |
| `404 not_found` | Unknown, or not visible to you | Treat as unavailable. Do not use it to probe for merchants or reservations. |
| `403 insufficient_scope` | Your key lacks `distribution:sell` | Ask Globagift to check your key |
| `409 state_conflict` | The reservation expired or was released | Reserve again |
| `409 idempotency_key_conflict` | The key was reused with a different body | Use a new key for a new sale |
| `422 insufficient_float` | Not enough available float | Top up your float |

A revoked grant also blocks captures: a reservation for a merchant whose grant was revoked after you reserved it returns `404` on capture. The held float returns to your available balance when the reservation expires.

## Current scope [#current-scope]

The distributor API covers the catalogue, selling and statements above. Discuss with us before you plan on:

- product descriptions, terms or merchant logos beyond what the product listing returns;
- webhooks for distributor events;
- pricing, margins or commission arrangements;
- physical cards.

[Contact Globagift](https://www.globagift.io/en/contact) to discuss becoming a distributor.
