Store

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

GET
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/availability

Bootstraps the storefront: whether it's open, which tiers are for sale, and which payment methods are connected.

terminal
curl https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/availability
json
{  "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

GET
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/shell

The seller's branding and their own legal copy, in one fetch.

json
{  "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

POST
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/discount

Validates a code without consuming it, so the client knows whether to route to checkout or to redemption.

terminal
curl -X POST https://api.envyauth.my.id/api/v3/store/s/<account_uuid>/discount \  -H "Content-Type: application/json" \  -d '{"code":"LAUNCH50"}'
FieldTypeRequiredMeaning
codestringyes1–64 characters.
json
{  "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

POST
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/intent

Builds a hosted checkout with the seller's gateway credentials and returns the URL to send the buyer to.

terminal
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"}'
FieldTypeRequiredMeaning
product_iduuidyesAn active product on this store.
gatewaystringyesstripe, paypal, midtrans, xendit, or tebex. Must be connected and enabled.
codestringnoA percent or flat promo code.
json
{  "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.

StatusCodeMeaning
400STORE_DISABLEDThe store is switched off.
400GATEWAY_UNAVAILABLEThat gateway isn't connected or is disabled.
401DISCORD_REQUIREDThe store requires Discord and no visitor identity was present.
404NOT_FOUNDUnknown gateway, or the product doesn't exist / isn't active.
404INVALID_CODEThe promo code isn't valid.
409FREE_CODEFree codes go to /redeem, not /intent.
409GATEWAY_CURRENCYThe gateway doesn't support the product's currency.
409CAPACITY_FULLThe seller has no key capacity left.
409CODE_EXHAUSTEDThe code hit its redemption cap during the request.
422PRODUCT_GONEThe product's target script no longer exists.
500INTERNALThe order row couldn't be written; the buyer was not sent to pay.
502GATEWAY_ERRORThe gateway refused to create the checkout.

Redeem a free code

POST
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/redeem

Mints a key immediately against a free code. No payment step.

terminal
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"}'
FieldTypeRequiredMeaning
product_iduuidyesAn active product on this store.
codestringyesMust be a free code. A percent or flat code returns INVALID_CODE.
json
{  "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

POST
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/status

Drives the return page after the buyer comes back from the gateway. Poll until status leaves pending.

terminal
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>"}'
json
{  "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 valueMeaning
pendingWaiting on the gateway webhook.
completedPaid and minted.
pending_capacityPaid, but the seller's key limit was full at mint time.
refundedReversed after completion.
failedThe gateway reported a failure.

Claim the key

GET
https://api.envyauth.my.id/api/v3/store/claim/:claim_token

Returns the minted key. The token itself is the authorization, so treat the claim URL as a secret.

json
{  "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

POST
https://api.envyauth.my.id/api/v3/store/s/:account_uuid/webhook/:gateway

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.