Before you write code
The API needs an approved merchant account and an active store. Keys are issued when the store is approved, but the store stays pending until OnCharge has opened its processing account, and until then every request fails with 403 store_inactive. Keep the keys; nothing needs to be regenerated.
- An API key (oc_key_…) and API secret (oc_sec_…), generated on the Stores page of the merchant portal. The secret is shown once.
- Every domain the store runs on, registered under Security → Domains, with and without www.
- A webhook endpoint and its signing secret (oc_cbsec_…).
- For RUO stores, a compliance feed connection code (occs_…).
Secrets stay on the server. Never put them in browser code, a mobile app, a public repository or a client-side environment variable, such as anything prefixed NEXT_PUBLIC_ or VITE_. The browser only ever receives the checkout URL.
HMAC-signed requests
OnCharge never accepts a bare API key, and the secret never travels over the network. Each request carries three headers, X-Oncharge-Key, X-Oncharge-Timestamp and X-Oncharge-Signature, and the signature takes four steps:
- Hash the exact bytes you send with SHA-256, as hex. GET requests hash the empty string.
- Build the signing string: the timestamp, the upper-case method, the path without its query string and the payload hash, joined by dots.
- Take the SHA-256 hex digest of your API secret and use that 64-character string as the key.
- Compute HMAC-SHA256 of the signing string with that key, as lower-case hex.
Requests more than 300 seconds off OnCharge’s clock are rejected, so keep your server synced. Serialize the payload once and send exactly what you hashed, because serializing again can change whitespace or key order. The docs publish a test vector and helpers in curl, Node.js, PHP and Python, and the quickstart runs one payment end to end. The Node SDK is documented and listed as coming soon to npm.
Creating checkout sessions with the peptide payment API
Create a session from your server with POST /api/v1/checkout/sessions when the buyer clicks Pay. The required fields are the amount in minor units, the currency, your reference and a return URL on a registered domain. Never accept an amount from the browser.
Send shipping for every order you ship. OnCharge releases the payout after the carrier confirms delivery to that address, and the address cannot be changed once recorded. Send an Idempotency-Key set to your order or cart ID, so a double click or retry returns the same open session instead of a second one. If the cart changes, create a new session with a new key.
Cart-first platforms can create the session before the order exists, then attach the order and shipping address with POST /api/v1/checkout/sessions/{id}/order within 24 hours and before tracking is reported. The checkout link lasts 30 minutes, so create a fresh session if the buyer comes back later. Show it by redirect, iframe, script tag or React component.
APIs and integrations across high-risk providers
This table leads with API and platform support, then covers the payment rails and payout terms your integration will handle. Competitor details come only from each provider’s public site.
| Attribute | OnCharge | Easy Pay Direct | PaymentCloud | SoarPay |
|---|---|---|---|---|
| Developer API | Yes, REST API with signed requests and webhooks | REST API and SDKs | Through third-party gateways | Through partner gateways |
| WooCommerce | Yes, plugin for classic and Blocks checkout; Magento and Wix in beta | Listed among integrations | Listed as an integration | Listed among supported platforms |
| Credit and debit cards | Yes, on a tokenized hosted checkout | Yes, plus Apple Pay and Google Pay | Major credit cards | All major cards |
| ACH / eCheck | Yes, bank debit for US shoppers, open to RUO stores | High-risk eCheck and ACH accounts | ACH and eCheck | ACH for qualifying merchants |
| Crypto payments | Yes, crypto and Card to Crypto from sign-up, paid to your own wallet | Not published | Not published | Not published |
| Payout timing | Per order, 1 day after the carrier confirms delivery | Not published | Not published | Cards 48–72 hours after batch close; ACH 1–3 business days |
| Onboarding, as described publicly | Online application with business and owner verification and a website review; RUO adds attestations, COAs, reviewer access and a compliance scan | Four steps; stated times range from 24–48 hours to a couple of weeks | States 24 hours to 5 days to start; often approved in 48 hours | Pre-approval about one business day; full underwriting 3–5 business days |
Last reviewed . Competitor information comes only from each provider's own public website; “Not published” means their site does not say, not that they do not offer it. Terms change, so confirm with each provider before you decide.
Sources: Easy Pay Direct, PaymentCloud, SoarPay.
Easy Pay Direct, PaymentCloud, SoarPay and other names shown are trademarks of their respective owners. Mention does not imply affiliation or endorsement.
Webhooks: verify, deduplicate, respond fast
Each webhook carries an OnCharge-Signature header with a timestamp and one or more v1 signatures. Compute HMAC-SHA256 over the timestamp, a dot and the raw payload, keyed with your oc_cbsec_ secret, compare in constant time, and reject anything more than 300 seconds old. Parse JSON only after verifying, since frameworks that parse for you change the bytes.
- Respond with any 2xx within 8 seconds and do slow work afterwards.
- Failed deliveries are retried with backoff for up to 24 hours.
- The same event can arrive twice, so store each OnCharge-Event-Id and skip repeats.
- Events can arrive out of order, so read the session when you need its current state.
- Events are kept for 30 days and can be listed and replayed to any endpoint.
- A store can have up to 16 endpoints, each with its own secret and choice of events.
Handle at least payment.captured, payment.refused, payment.cancelled, refund.succeeded and chargeback.opened. A payment.pending with the payment method bank_debit means a bank debit is still being collected: ship only after payment.captured. Every event’s data.rail says whether the payment came from card, crypto or card_to_crypto.
The shipments API and delivery-gated payouts
Each order is paid out one day after the carrier confirms every package reached the order’s shipping address. When the order ships, call POST /api/v1/shipments with the session ID or your order ID and a list of carriers and tracking numbers.
- Carriers are USPS, UPS, FedEx and DHL Express. The carrier can be left out when the number’s format identifies it.
- Up to 10 tracking numbers per order; the order counts as delivered when all of them are.
- Repeats are safe. A number already on the order is accepted again without change.
- The order must be captured first, or the call fails with 409 order_not_paid.
- Each number is accepted or rejected on its own, with codes such as carrier_mismatch or tracking_number_in_use.
Follow progress with GET /api/v1/shipments?session_id=… or the delivery.confirmed webhook. Show orders that are on_hold to your staff along with the hold reason, such as a delivery that did not match the address. The shipments docs list every state.
The compliance feed for Next.js and custom RUO stores
A compliant RUO store keeps its catalog behind a research gate, so OnCharge cannot read it as an anonymous visitor. The compliance feed solves that: three read-only GET endpoints your store serves on its own host, by default under /.well-known/oncharge-compliance.
- proof: shows that your server holds the connection code. Not authenticated.
- content: one page of published products and pages, including gated products and your terms, privacy, refund, shipping and contact pages. Signed requests only.
- reviewer-access: reports whether a reviewer login is ready. Signed requests only.
Each signed request carries a connection ID, a timestamp, a single-use nonce and an HMAC, all checked before you answer. Next.js stores can use createComplianceFeedRoute, and any JavaScript runtime can use the dependency-free reference handler in the docs. Magento and Wix, both in beta, have the feed built in. Never serve drafts, orders or customers, and never hide or rewrite content for OnCharge. You give the reviewer login to OnCharge yourself, never through the endpoint. The compliance feed reference has the full contract, and the RUO Program page has the store rules it checks.
Testing, going live and headless setups
OnCharge does not offer a self-serve sandbox. Check your signing code against the published test vector, sign your own webhook fixtures to test the handler, and register localhost as a domain so the checkout can be framed during development. Then make one small live payment on production and refund it with POST /api/v1/refunds and an Idempotency-Key.
Before launch, confirm that secrets are server-side only, every production domain is registered, sessions use idempotency keys, shipping is sent for every shipped order, orders are marked paid from the webhook or a server-side check, and tracking is reported for each shipment. RUO stores also need the compliance feed verified and a reviewer login set up.
Headless stores follow the same contract. OnCharge is not a Shopify payments app and cannot appear in Shopify’s checkout, but a headless storefront with its own checkout can take payment with OnCharge and record the order in Shopify from your server; check that this fits your Shopify plan and terms first. On other headless commerce platforms, OnCharge can be built in as a custom payment provider using the same API. The headless guide has the full flow, and you can start an application to get keys.
Frequently asked questions
Is there a sandbox for the OnCharge API?
Not a self-serve one. You test signing against published test vectors, test your webhook handler with fixtures you sign yourself, and confirm the whole flow with a small live payment that you refund. If you need a separate test configuration, ask your OnCharge contact before launch.
Why does every request return 403 store_inactive?
The store is approved but still pending while OnCharge opens its processing account, or it has been suspended. Keys issued at approval start working once the store is active, without being regenerated.
Can I mark an order paid when the buyer returns to my site?
No. The return URL only tells you the buyer came back. Mark orders paid from the payment.captured webhook or by reading the session on your server.
Which languages can call the API?
Any language that can make HTTPS requests and compute HMAC-SHA256. The docs include signing examples in curl, Node.js, PHP and Python, each using only the language’s standard library.
Does a store outside the RUO Program need the compliance feed?
No. The feed exists so OnCharge can review a catalog behind a research gate, so only RUO stores serve it. Other stores can skip that part of the integration.
What happens if my webhook endpoint goes down?
OnCharge retries failed deliveries with backoff for up to 24 hours. Every event is also kept for 30 days, so you can list what you missed and replay it to your endpoint with the same event ID.
Next steps
- Get startedCreate your account and tell us about your store.
- PricingPlans quoted for your business, fees shown before you commit.
- RUO Program termsThe rules research-use-only stores agree to.
Approval is subject to partner bank underwriting.
Related guides
- GatewayPeptide payment gateway: what it does and what to look forWhat a peptide payment gateway does, how it differs from a processor and merchant account, and OnCharge’s hosted, iframe, script and React checkout options.
- WooCommerceWooCommerce peptide payments for research-use-only storesTake cards on a WooCommerce research peptide store: the OnCharge plugin for classic and Blocks checkout, the compliance feed, tracking-based payouts and crypto.
- PayoutsHow peptide merchant payouts after delivery workHow peptide merchant payouts after delivery work at OnCharge: per-order release after carrier-confirmed delivery, address checks, tracking, holds and reserves.
- Store readinessPreparing your store for a research peptide merchant accountStore-readiness steps for a research peptide merchant account: research gate, RUO statement, COAs, policies, reviewer login, and why applications stall.
- DisputesPeptide chargeback protection, layer by layerHow research peptide stores reduce chargebacks with OnCharge: fraud screening, step-up SMS, Ethoca and Verifi alerts, delivery proof and automated evidence.