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

FieldTypeRequiredDescription
productIdintegeryesGift card product ID.
countryCodestringyesTwo-letter ISO country code.
unitPricenumberyesRecipient-facing unit denomination.
quantityintegernoQuantity from 1 to 5 (default 1).
quotedTotalUsdnumberyesCurrent USD total returned by the price endpoint.
recipientEmailstringyesEmail address for gift card delivery.
recipientPhonestringnoRecipient 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

StatuserrorMeaning
403insufficient_scopeThis project key is not allowed to do that.
400idempotency_key_requiredSend an Idempotency-Key header.
402insufficient_fundsThe wallet balance is too low.
400gift_card_order_details_requiredProvide a valid recipient email and current quote.
409gift_card_price_changedThe price changed; request a new quote.
422gift_card_order_rejectedThe provider rejected the order and the USD wallet was refunded.
503gift_cards_live_mode_requiredGift card purchases are currently unavailable.

Related references

Browse the complete endpoint directory, the developer portal and the security and controls guide.