Prerequisites
- API key with
gifts:create(to create the gift) andorders:create(to claim it) scopes - A plan for what product to order on the recipient’s behalf (store this at gift creation time)
- A mechanism to watch for
gift-status-changedwebhooks
The flow
- Create the gift with
POST /v2/giftsand store your fallback plan (product/variant + recipient address) in your own database, keyed bygiftId. - Watch
gift-status-changedwebhooks. If the recipient claims the gift themselves, cancel your fallback plan — the gift is handled. - Trigger auto-claim after your deadline (e.g., N days after creation) if the gift is still unclaimed.
Store the fallback plan at creation time
When you create the gift, immediately record what you’ll order if the recipient doesn’t claim it:JavaScript
Cancel the plan if the recipient claims
Subscribe togift-status-changed webhooks. When a gift’s status changes to claimed (or any terminal state that means the recipient acted), mark your fallback plan as cancelled:
JavaScript
Trigger auto-claim
After your deadline, if the fallback plan is stillpending, claim the gift:
JavaScript
Python
409 handling
The claim endpoint returns409 Conflict in two distinct situations:
JavaScript
Related
- Send Triggered Gifts — creating the gift that this pattern wraps
- Track Order Fulfillment — tracking the order after a successful claim