Webhooks
TL;DR. Dr Green has inbound webhook endpoints that its payment and KYC processors call into. As an external store builder, you are not the consumer of these — they’re between Dr Green and its third-party services. There is currently no outbound webhook system for stores: your store must poll the relevant endpoints to detect order, KYC, and commission state changes.
What this means for your store
If you’ve built integrations with Stripe, Shopify, or PayPal, you’re used to the pattern:Inbound webhooks (between Dr Green and its processors — you can ignore these)
For completeness, the four webhook endpoints that exist on the Dr Green API:
These endpoints are inbound to Dr Green — they receive POSTs from third-party services. The payload format is dictated by each upstream processor, not by Dr Green, and is not declared in the OpenAPI spec.
As a store builder, you don’t call these and they don’t call you. They’re listed here only so you understand the full surface — and so you don’t accidentally try to use them.
How the FirstAML KYC flow actually works
This is the most-asked-about flow, so worth spelling out clearly:- Your store does not integrate with FirstAML. You don’t have FirstAML credentials, you don’t render their UI, you don’t receive their callbacks.
- The outbound Dr Green → FirstAML webhook (step 2 above) is a separate, internal flow — not exposed in the public API surface.
- The customer interacts with FirstAML directly (typically via a hosted verification portal linked from the email Dr Green sends).
- All you do is
POST /dapp/clientsto start the flow, then pollGET /dapp/clients/{clientId}untilisKYCVerified === trueandadminApproval === 'VERIFIED'.
The polling pattern (what your store actually does)
Until outbound webhooks exist, build your store around polling. Here’s a battle-tested pattern.What to poll
How to poll efficiently
Pattern: tiered polling intervals.
Pattern: only poll active items.
Don’t poll for orders that are already in a terminal state (
shipped, cancelled, rejected). Maintain a list of “active” order IDs in your store DB; remove them once they reach a terminal status.
Pattern: jittered polling.
If your store has many holders, don’t poll all of them on the same cron-second — you’ll create thundering herds against the Dr Green API. Add ±10% random jitter to every interval.
What not to do
- Don’t poll every order on every tick. Use the active-set pattern above.
- Don’t poll faster than 1 req/sec per holder. The backend isn’t currently rate-limited but politeness avoids future enforcement pain.
- Don’t poll without backoff on errors. A backend hiccup shouldn’t get amplified by your retry storm. Exponential backoff on consecutive failures.
Future outbound webhook design (when it ships)
When Dr Green ships outbound webhooks for store builders, the design we’d recommend (and have flagged) looks like:- HMAC-SHA256 signing of payload with a per-store secret you configure in the DAPP
- Replay-protection timestamp in the signature payload
- Standard event types:
order.created,order.approved,order.rejected,order.shipped,client.kyc.completed,commission.accrued - At-least-once delivery with idempotency on the receiving side keyed by event ID
- Retry policy of ~5 attempts over 24 hours