key system to prevent redundant gift deliveries. This idempotency system ensures that your integration remains reliable even in the event of network timeouts, automated retries, or accidental double-clicks.
Including a unique key is not mandatory, but it is strongly recommended for all production integrations to ensure billing accuracy and a seamless recipient experience.
How it Works
When you include akey in your gift request, Snappy checks if that specific key has been used before.
- If it’s a new key: We process the gift as usual.
- If the key exists: We reject the duplicate and return a specific error, ensuring no additional gift is sent or billed.
Implementing Unique Keys
We recommend generating a unique key for every gift intent. You can use two primary strategies:- UUID (Recommended): Generate a random version 4 UUID for every gift object.
- Deterministic Logic: Create a string based on your internal business rules (e.g.,
user_123_anniversary_2024). This is perfect for ensuring a recipient only receives one gift for a specific event.
Usage Example
Add thekey field to the individual recipient objects in your payload:
Handling Errors & Partial Success
If a duplicate key is detected, the API will returnerrorCode: 41008.
Partial Success ScenariosBecause Snappy processes gift batches, a single request may result in a “Partial Success.” This happens if some keys in your list are new while others are duplicates.