# KantoPay API Accept payments and deliver in-game rewards. - [Build a storefront](https://kantopay.com/documents#storefront) — Browse products and create checkouts using a public storefront token. - [Connect your game server](https://kantopay.com/documents#reference) — Manage payments and deliver rewards using a secret API key. - [Set up webhooks](https://kantopay.com/documents#webhooks) — Receive payment events on your server. Not sure which you need? [Compare the two APIs](https://kantopay.com/documents#compare). ## FAQ **Do you support subscriptions?** Not yet. Subscriptions are coming; for now every purchase is a one-time payment. **Can a paid order be reversed?** Yes. KantoPay can refund it (a store asks KantoPay support; stores can’t refund from the dashboard or the API), and a buyer can win a chargeback. The order’s `reversal_type` says which, and [`/rewards/revocations`](https://kantopay.com/documents#ep-rrevoke) or the [`order.refunded` event](https://kantopay.com/documents#webhooks-events) tells your server what to take back. **How do I make sure each server only gets its own rewards?** Each API key is bound to a single server. A key only receives deliveries routed to that server (plus any product set to deliver to *all* servers), so every server in your network polls safely with its own key. **What happens if my plugin polls twice?** Delivery is idempotent. A command stays in the pending pool until acknowledged, and acknowledging is safe to retry. ## Glossary **QRPh** — the Philippine national QR standard; one QR pays from any participating bank or e-wallet. **Payment link** — a hosted checkout page (and QR) for a single order, tracked from `pending` to `paid`. **Reward / command** — the in-game action delivered to a server when an order settles. **Idempotent** — safe to call more than once; repeats don’t double-charge or double-deliver. --- ## Storefront API Build your own store on the same catalogue, pricing and checkout as the hosted store: a website, a Discord bot or an in-game menu. Requests need no key, only your public **storefront token** (`kps_…`) from [Dashboard › Servers](https://kantopay.com/dashboard/servers). **It works from a static site**: plain HTML and JavaScript on GitHub Pages, Netlify, Cloudflare Pages or any web host, with no server of your own. No secret API key is needed. Two actions take a token of their own: a player’s orders need that player’s `player_token` (from [`/players/link`](https://kantopay.com/documents#ep-plink)), and cancelling an order needs the `cancel_token` its checkout returned. ``` https://api.kantopay.com/v1/shops/kps_63bde17336594cbda90a0b7f5dd460d6/products ``` See one running at [example.kantopay.com](https://example.kantopay.com), a whole store in one HTML file. [Why a token and not your slug?](https://kantopay.com/documents#why-token) · [Capabilities](https://kantopay.com/documents#compare) ### Quick start Read the catalogue, price the cart, send the buyer to checkout. You need a published product and your storefront token; use your [test token](https://kantopay.com/documents#storefront-test) (`kps_test_…`) while you build, so no real money moves. Pick a language: none of them needs a library or a download. ```bash # bash, macOS, Linux or Git Bash. Use your test token while you build. SHOP=https://api.kantopay.com/v1/shops/kps_test_your_token # 1. What's for sale. Copy a product id; show effective_amount (the price after any sale). curl -sS $SHOP/products # 2. Price the cart. Send the same cart to checkout so both price the same thing. CART='"player_name":"Steve","items":[{"product_id":"PRODUCT_ID","quantity":1}]' curl -sS -X POST $SHOP/quote -H 'Content-Type: application/json' -d "{$CART}" # 3. Take the money. Send the buyer to redirect_url; keep order_id. curl -sS -X POST $SHOP/checkout -H 'Content-Type: application/json' \ -d "{$CART,\"buyer_email\":\"me@example.com\",\"idempotency_key\":\"order-1\"}" # Later: is it paid? curl -sS https://api.kantopay.com/v1/orders/ORDER_ID ``` ```javascript // Run as