OnCharge developer docs
OnCharge gives your store a hosted card checkout, risk screening on every payment, dispute tools, and payouts released when the order is delivered. You integrate it with a few signed API calls from your server and either send the shopper to OnCharge's checkout page or embed it in yours. Card details are entered on OnCharge's page and never pass through your servers.
How it works#
- Create a checkout session. When the shopper is ready to pay, your server calls
POST /api/v1/checkout/sessionswith the amount, your order reference, a return URL and, for goods you ship, the shipping address. The request is signed with your API secret. - Show the checkout. Redirect the shopper to the session's checkout URL, or embed it in an iframe on your own checkout page. See Checkout.
- Confirm the payment. OnCharge sends a signed webhook (
payment.captured). Mark the order paid when it arrives. - Ship and report tracking. Send the carrier and tracking number to
POST /api/v1/shipments. OnCharge follows the package with the carrier. - Get paid. The order's payout is released 1 day after the carrier confirms delivery to the checkout address. Orders with nothing to ship (digital goods and services) are paid 7 days after payment. See Shipments & payouts.
Choose your integration#
| You run | Start here |
|---|---|
| WooCommerce | WooCommerce plugin: install, paste your keys, done. Shipping and tracking are reported automatically. |
| Magento 2 | Magento 2 module (beta) |
| Wix | Wix integration (beta) |
| Next.js | Next.js guide |
| React single-page app | React guide |
| Any site with a server (PHP, Node, Python, …) | HTML & iframe guide |
| Custom or headless commerce | Custom & headless guide |
| An AI coding assistant | Build with AI: prompts, a Claude skill, a custom GPT and an MCP server |
New to OnCharge? Follow the Quickstart first.
Key concepts#
Store. Each store has its own API keys, registered domains and webhook endpoint. Create stores and keys in the merchant portal at app.oncharge.io.
Server-side only. API requests are signed with your API secret, so they must come from your server. The browser only ever receives a checkout URL.
Amounts are integers in the currency's minor unit: 4900 is $49.00. Currencies are ISO 4217 codes such as USD.
Registered domains. The return_url must be on one of the store's registered domains, and only pages on those domains may embed the checkout.
Session statuses.
| Status | Meaning |
|---|---|
created | Waiting for the shopper. |
pending | The shopper has to complete an extra step. |
authorized | Approved but not yet captured. |
captured | Paid. |
refused | Declined. |
cancelled | Cancelled before capture. |
error | The payment could not be completed. |
expired | Not paid within 30 minutes. |
Resources#
- API reference and the OpenAPI 3.1 spec
- SDKs:
@oncharge/nodefor your server,@oncharge/jsfor the browser llms.txtandllms-full.txtfor AI assistants- Testing & going live
- Questions: contact OnCharge