Store
These are the endpoints the buyer-facing storefront calls. They are public — no API token, no cookie. The account_uuid in the path is the seller's account and the claim_token is the authorization for a claim.
All responses use the standard envelope. Every endpoint here is rate-limited per IP and returns 429 with code: "RATE_LIMIT" when you exceed it.
Availability
Bootstraps the storefront: whether it's open, which tiers are for sale, and which payment methods are connected.
curl https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/availability{ "success": true, "data": { "enabled": true, "require_discord": true, "available": true, "products": [ { "id": "uuid", "label": "30 days", "duration_days": 30, "amount_cents": 49900, "currency": "IDR" } ], "gateways": [ { "id": "midtrans", "label": "Midtrans", "currencies": ["IDR"] } ], "discord": { "connected": true, "username": "someone" } }, "requestid": "uuid"}available reflects the seller's remaining key capacity. When it is false the store is open but cannot issue a key right now, so checkout will refuse.
A closed store returns 200 with enabled: false and empty arrays rather than an error, so nothing leaks about the account.
Shell
The seller's branding and their own legal copy, in one fetch.
{ "success": true, "data": { "brand": { "name": "Atomic Hub", "product": "Atomic Premium", "logo_url": "https://.../store-logos/<account_id>" }, "legal": { "tos": "plain text", "privacy": "plain text" } }, "requestid": "uuid"}Every field is nullable. null means fall back: a plain page for branding, the platform's own /terms and /privacy-policy for legal. The legal copy is plain text and must never be rendered as markup.
Check a promo code
Validates a code without consuming it, so the client knows whether to route to checkout or to redemption.
curl -X POST https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/discount \ -H "Content-Type: application/json" \ -d '{"code":"LAUNCH50"}'| Field | Type | Required | Meaning |
|---|---|---|---|
code | string | yes | 1–64 characters. |
{ "success": true, "data": { "kind": "percent", "amount": 50, "bonus_days": 7 }, "requestid": "uuid"}kind is free, percent, or flat. A free code must go to redeem; the other two go to intent.
An invalid, expired, inactive, or fully-redeemed code returns 404 with code: "INVALID_CODE".
Start a checkout
Builds a hosted checkout with the seller's gateway credentials and returns the URL to send the buyer to.
curl -X POST https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/intent \ -H "Content-Type: application/json" \ -d '{"product_id":"<uuid>","gateway":"stripe","code":"LAUNCH50"}'| Field | Type | Required | Meaning |
|---|---|---|---|
product_id | uuid | yes | An active product on this store. |
gateway | string | yes | stripe, paypal, midtrans, xendit, or tebex. Must be connected and enabled. |
code | string | no | A percent or flat promo code. |
{ "success": true, "data": { "redirect_url": "https://checkout.stripe.com/..." }, "requestid": "uuid"}When a discount brings the total to zero, no gateway is involved. The key is minted immediately and the response carries minted: true with redirect_url pointing at the claim page instead.
| Status | Code | Meaning |
|---|---|---|
| 400 | STORE_DISABLED | The store is switched off. |
| 400 | GATEWAY_UNAVAILABLE | That gateway isn't connected or is disabled. |
| 401 | DISCORD_REQUIRED | The store requires Discord and no visitor identity was present. |
| 404 | NOT_FOUND | Unknown gateway, or the product doesn't exist / isn't active. |
| 404 | INVALID_CODE | The promo code isn't valid. |
| 409 | FREE_CODE | Free codes go to /redeem, not /intent. |
| 409 | GATEWAY_CURRENCY | The gateway doesn't support the product's currency. |
| 409 | CAPACITY_FULL | The seller has no key capacity left. |
| 409 | CODE_EXHAUSTED | The code hit its redemption cap during the request. |
| 422 | PRODUCT_GONE | The product's target script no longer exists. |
| 500 | INTERNAL | The order row couldn't be written; the buyer was not sent to pay. |
| 502 | GATEWAY_ERROR | The gateway refused to create the checkout. |
Redeem a free code
Mints a key immediately against a free code. No payment step.
curl -X POST https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/redeem \ -H "Content-Type: application/json" \ -d '{"product_id":"<uuid>","code":"FREEWEEK"}'| Field | Type | Required | Meaning |
|---|---|---|---|
product_id | uuid | yes | An active product on this store. |
code | string | yes | Must be a free code. A percent or flat code returns INVALID_CODE. |
{ "success": true, "data": { "key": "<32-char>", "claim_url": "https://envyauth.my.id/store/claim/<claim_token>", "status": "completed" }, "requestid": "uuid"}Capacity is consumed before the code's counter moves, so a full store never burns a limited code.
Poll an order
Drives the return page after the buyer comes back from the gateway. Poll until status leaves pending.
curl -X POST https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/status \ -H "Content-Type: application/json" \ -d '{"order_ref":"<order_ref>"}'{ "success": true, "data": { "status": "completed", "claim_url": "https://envyauth.my.id/store/claim/<claim_token>" }, "requestid": "uuid"}claim_url is null until the order completes.
| Status value | Meaning |
|---|---|
pending | Waiting on the gateway webhook. |
completed | Paid and minted. |
pending_capacity | Paid, but the seller's key limit was full at mint time. |
refunded | Reversed after completion. |
failed | The gateway reported a failure. |
Claim the key
Returns the minted key. The token itself is the authorization, so treat the claim URL as a secret.
{ "success": true, "data": { "key": "<32-char>", "status": "completed" }, "requestid": "uuid"}Anything that isn't a completed order with a minted key returns 404 with code: "NOT_FOUND".
Webhooks
Called by the payment gateway, not by you. The signature or verification token proves the caller, and this is what flips an order to completed and mints the key.