Public developer API
POST /v1/gift-cards/purchase
Purchases a gift card from the organization USD wallet after rechecking the provider price. Delivery details are encrypted at rest and can be retrieved through the order endpoint.
Access
A project-specific API key (Authorization: Bearer dapi_live_...) and its Business ID (X-Business-Id). Rate limited per business (120 calls a minute by default).
Requires an Idempotency-Key header.
Send an Idempotency-Key header and reuse it only when retrying the same purchase.
First call the price endpoint and pass its totalUsd as quotedTotalUsd; if the current price changed, the purchase is rejected without charging.
Body
| Field | Type | Required | Description |
|---|---|---|---|
productId | integer | yes | Gift card product ID. |
countryCode | string | yes | Two-letter ISO country code. |
unitPrice | number | yes | Recipient-facing unit denomination. |
quantity | integer | no | Quantity from 1 to 5 (default 1). |
quotedTotalUsd | number | yes | Current USD total returned by the price endpoint. |
recipientEmail | string | yes | Email address for gift card delivery. |
recipientPhone | string | no | Recipient phone number in international format. |
Example request
curl --request POST \
--url 'https://production.dutchapi.co/v1/gift-cards/purchase' \
--header 'X-Business-Id: YOUR_BUSINESS_ID' \
--header 'Authorization: Bearer bsk_live_YOUR_BUSINESS_SECRET' \
--header 'Idempotency-Key: gift-cards-0001' \
--header 'Content-Type: application/json' \
--data '{"productId":10,"unitPrice":25,"quantity":1,"countryCode":"US","recipientEmail":"customer@example.test","quotedTotalUsd":26.5}'
Response 201
{
"data": {
"transactionId": "gft_8f2c1a",
"status": "completed"
}
}
Errors
| Status | error | Meaning |
|---|---|---|
| 403 | insufficient_scope | This project key is not allowed to do that. |
| 400 | idempotency_key_required | Send an Idempotency-Key header. |
| 402 | insufficient_funds | The wallet balance is too low. |
| 400 | gift_card_order_details_required | Provide a valid recipient email and current quote. |
| 409 | gift_card_price_changed | The price changed; request a new quote. |
| 422 | gift_card_order_rejected | The provider rejected the order and the USD wallet was refunded. |
| 503 | gift_cards_live_mode_required | Gift card purchases are currently unavailable. |