API Documentation

Integrate Jamesinvoicing into any website. All requests must be over HTTPS. See the custom website integration guide for copy-paste PHP, Node.js, Python, and cURL examples.

Authentication

Send your API key as a bearer token. Generate keys from API Keys in your dashboard.

Authorization: Bearer pch_live_xxxxxxxxxxxxxxxxxxxxxxxxx

Endpoints

  • POST /api/public/v1/auth — validate credentials. Returns { valid, merchant_id, environment, status }.
  • GET /api/public/v1/ping — health check.

Code examples

// PHP
$ch = curl_init('https://jamesinvoicing.com/api/public/v1/auth');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Bearer pch_live_xxxxxxxxxxxxxxxxxxxxxxxxx',
  'Content-Type: application/json',
]);
$response = curl_exec($ch);

Webhooks

Each request is signed with HMAC-SHA256 using your webhook_secret. Always verify the X-PCH-Signature header before processing.

// Verify the X-PCH-Signature header (HMAC-SHA256 of the raw body using your webhook secret)
const crypto = require('crypto');
const expected = crypto.createHmac('sha256', WEBHOOK_SECRET).update(rawBody).digest('hex');
if (expected !== req.headers['x-pch-signature']) return res.status(401).end();

WordPress Plugin v2.0.2

  1. Install Jamesinvoicing Crypto Payments from WordPress.org or upload the ZIP (v2.0.2).
  2. WooCommerce, CartFlows, FunnelKit/WooFunnels, LaunchFlows and WPFunnels use the shared integration API when the checkout produces a WooCommerce order.
  3. Open Jamesinvoicing → Add API, paste your API Key, and save. You should see Connected.
  4. Open Jamesinvoicing → xPub Manager and register your Bitcoin address or xPub.

WooCommerce and funnel order API

Plugin v2.0.2 calls these endpoints from WordPress. The browser must never call them with a secret key or supply a trusted payment status.

  • POST /api/public/v1/integration/orders — creates one invoice per platform order. Send an Idempotency-Key.
  • GET /api/public/v1/integration/orders/:platform_order_id — reads the merchant-scoped order and invoice state.
  • POST /api/public/v1/integration/sync — updates descriptive funnel context and returns server-derived payment state.
  • POST /api/public/v1/integration/webhooks — registers the store's HTTPS callback and returns its signing secret once.
Authorization: Bearer pch_live_xxxxxxxxxxxxxxxxxxxxxxxxx
Idempotency-Key: JI-WC-1-1042
X-JI-Platform: cartflows
X-JI-Site-Url: https://store.example

Supported WordPress platform values are woocommerce, cartflows, woofunnels, launchflows and wpfunnels. The plugin always obtains the amount from the WooCommerce order total.

POST /orders accepts an optional return_url: the store's own thank-you page, which the buyer is sent back to after the payment is verified. It is only stored when its origin matches the calling store's X-JI-Site-Url, and it is never read from the browser, so a customer cannot change where the confirmed order lands.

POST /api/public/v1/integration/orders
{
  "platform_order_id": "1017",
  "platform_order_number": "1017",
  "customer_email": "buyer@example.com",
  "fiat_amount": 44.99,
  "fiat_currency": "USD",
  "return_url": "https://store.example/checkout/order-received/1017/?key=wc_order_x"
}

Error codes

  • 401 — missing or invalid credentials
  • 403 — key is disabled or suspended
  • 429 — too many requests
  • 500 — server error, retry later