habanero api: Prevent Duplicate Free-Spin Grants on Retries
A habanero api integration needs more than a successful game launch when your casino runs free-spin promotions. Consider a common failure: your platform requests an award, the connection times out, and a worker retries. If the first request succeeded remotely, the player may receive two awards while your back office records one. The practical solution is an issuance workflow that treats uncertain outcomes as a distinct state—not as permission to send again.
This guide focuses on preventing duplicate promotional grants. It does not assume that every Habanero integration exposes the same promotion features, endpoints, or retry guarantees. Confirm those details for your contracted integration route before implementing the workflow.
habanero api promotion retries: start with the contract
Before designing an award queue, establish whether free-spin issuance is supported for your selected games, currencies, jurisdictions, and commercial arrangement. A studio catalogue entry alone does not establish promotion eligibility.
Ask your integration contact for explicit answers:
- Can your platform supply a unique external award reference?
- Does that reference prevent duplicate creation, or merely identify records?
- How long is any deduplication protection retained?
- Can you query an award by that reference after a timeout?
- Does a successful response mean accepted, queued, or available to the player?
- Are cancellation and award-status notifications supported?
Also establish which system owns each guarantee. If requests pass through an aggregator, an aggregator acknowledgment may not mean the studio has completed issuance. You need a documented interpretation of the full path, not just the first HTTP response.
Separate correlation from idempotency
A correlation reference helps support teams find a request. An idempotency key prevents repeated requests from creating repeated effects under defined conditions. They are not interchangeable.
If documentation only promises that a reference is echoed in responses, do not treat it as duplicate protection. Verify the behavior when the same reference arrives concurrently, when its payload changes, and when it is reused after the retention window.
Create one durable record for each intended award
Record the operator's decision to issue an award before contacting the external service. Give that decision a stable internal identity that survives worker restarts, transport retries, and support investigation.
An illustrative internal record could contain:
- `award_id`: the permanent identity of this intended grant.
- `eligibility_event_id`: the qualifying event that triggered it.
- `player_id` and `brand_id`: the intended recipient and tenant.
- `campaign_version`: the exact promotion rules applied.
- `game_set`, `currency`, and `spin_count`: the intended award terms.
- `provider_reference`: the external reference, where supported.
- `payload_fingerprint`: a hash of normalized, immutable award terms.
- `status` and timestamps: the current issuance state and its history.
These are suggested internal fields, not a claim about Habanero's request schema. Map them to the documented interface rather than sending invented parameters.
Make business uniqueness explicit
Use a database constraint to stop two workers from independently creating the same award. A suitable uniqueness rule might combine brand, player, campaign version, qualifying event, and award type.
Do not deduplicate solely by player and campaign. A recurring promotion may legitimately reward several qualifying events. Conversely, generating a fresh award ID for every retry defeats the protection: the retry must remain attached to the original business decision.
Represent uncertainty instead of hiding it
A useful issuance state machine distinguishes at least five outcomes:
- Prepared: eligibility and award terms are recorded locally.
- Sending: a worker has claimed the award for delivery.
- Confirmed: external evidence establishes successful issuance.
- Rejected: a documented response establishes that issuance failed.
- Unknown: the request may have succeeded, but the evidence is incomplete.
A timeout after sending belongs in `Unknown`, unless the contract provides a stronger guarantee. A connection failure can also be ambiguous if an intermediary received and forwarded the request before the failure became visible locally.
Store delivery attempts separately from the award. One award can have several attempts, each with its own timestamps, transport result, and sanitized response. This preserves the difference between “three delivery attempts” and “three promotional grants.”
Make queue delivery durable
Write the award and an outbound job record in the same database transaction. An outbox worker can then deliver committed awards without depending on a fragile sequence of database write followed by queue publish.
Use a lease or equivalent claim mechanism to reduce concurrent processing. However, worker locking alone cannot establish remote uniqueness. A stalled worker may finish after another worker takes over, so external idempotency or a safe reconciliation path remains essential.
Resolve unknown outcomes before resending
Recovery should follow evidence rather than a generic exponential-backoff loop.
- Query by the original reference, if the integration supports it. Match the returned player, currency, game eligibility, and award terms against your stored record.
- Account for visibility delays. An immediately missing record may reflect asynchronous processing rather than non-issuance. Use the documented processing window before drawing conclusions.
- Replay only under a valid guarantee. If the interface guarantees idempotent issuance, resend the same reference and the same semantic payload within its stated limits.
- Escalate unresolved cases. If neither lookup nor protected replay is available, hold the award for investigation instead of blindly issuing another.
A definitive rejection may permit another delivery attempt after the cause is corrected. But changing the player, currency, spin count, or game set changes the intended award. Use an explicit replacement or amendment process rather than silently mutating a request associated with an existing key.
Example: the response disappears
Your system records award `AW-2041` for an eligible player and sends it. The remote service creates the grant, but the response is lost. Your worker marks the outcome unknown.
A recovery job searches using the original reference. If it finds a matching grant, it records the external identifier and confirms the existing award. No new grant is needed.
If the lookup remains inconclusive, keep the uncertainty visible. “Pending confirmation” is a more accurate support message than “Failed—please claim again.”
Keep player messaging and support actions consistent
The player interface should distinguish qualifying for a promotion from having an award ready to use. Do not display “Your free spins are available” merely because a local queue accepted a job.
Support tools should show the immutable award terms, delivery history, external evidence, and current recovery action. A manual “resend” button must use the same controlled workflow; it should not bypass uniqueness checks or create a fresh award automatically.
Before dispatch, apply the required account, self-exclusion, and jurisdiction checks. If eligibility changes while an outcome is unknown, investigate the existing grant rather than issuing a replacement. Cancellation, where available, is a separate operation with its own uncertain outcomes.
Test the failures that create duplicate grants
A successful sandbox request does not prove safe recovery. Include these cases in acceptance testing:
- Two workers attempt the same award concurrently.
- The remote service accepts a grant, but the response is dropped.
- A lookup temporarily returns no record after acceptance.
- A worker crashes after remote success but before local confirmation.
- The same reference is submitted with different award terms.
- Recovery runs after the deduplication retention window expires.
- A support agent requests a resend while automated recovery is active.
For each test, check both your database and the external award record. The acceptance condition is not simply a clean queue: it is one intended award, no unexplained additional grants, and an auditable outcome.
Monitor unknown-outcome age and unresolved award count. Investigate trends before increasing retry volume; more attempts can amplify the underlying problem.
Plan the integration scope with GamingAPI
GamingAPI offers 16,000+ games from 150+ studios through one API, with a seamless wallet, multi-currency support, and USDT deposits. Promotion issuance still needs separate technical verification: a shared wallet does not automatically establish free-spin eligibility or duplicate-grant protection.
Review pricing for the $350 one-time setup and 10% of positive GGR model. Before building this workflow, contact GamingAPI to confirm Habanero availability, supported promotional operations, and the applicable reconciliation guarantees for your integration.
FAQ
Is it safe to retry every timed-out award request?
No. A timeout does not establish that issuance failed. Use documented idempotent replay or reconcile the original reference first.
Can a local database constraint prevent all duplicate grants?
No. It prevents duplicate local award creation, but repeated external delivery can still create duplicates unless the remote workflow protects against it.
What if award lookup is unavailable?
Use protected replay only if the contract explicitly supports it. Otherwise, hold uncertain cases for investigation and define an escalation procedure before launching the promotion.