API Documentation

Integrate EmbPay into your applications with our simple REST API. Build custom checkout flows, manage products programmatically, and handle webhooks.

Quick Start

Get up and running with EmbPay API in minutes. All API requests require authentication using your API key, which you can find in your dashboard settings.

Base URL: https://www.embpay.com/api/v1
Format: JSON
Authentication: Bearer Token

Create a Product

POST /products

Request

curl -X POST https://www.embpay.com/api/v1/products \
  -H "Authorization: Bearer ep_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "sku-ebook-001",
    "title": "Premium Ebook",
    "description": "A comprehensive guide to digital marketing",
    "amount": 4900,
    "currency": "usd"
  }'

Response

{
  "id": "cmsdkggko0003jr0428cxqhko",
  "external_id": "sku-ebook-001",
  "link_url": "https://www.embpay.com/p/cmsdkggko0003jr0428cxqhko",
  "active": true
}

Embed Checkout

Simple copy-paste integration

The easiest way to add payments to any website. Copy this code and paste it where you want the buy button to appear:

<!-- EmbPay buy button -->
<script
  src="https://www.embpay.com/embed.js"
  data-product="PRODUCT_ID"
  data-text="Buy Now"
  data-color="#4f46e5"
  data-mode="popup"
  async
></script>

Embed Options

data-productProduct ID (required)
data-textButton label
data-colorButton colour (hex)
data-modepopup | redirect | embed

The dashboard's Share & embed page generates this code for each product.

JavaScript SDK

For advanced integrations

For a custom cart: your server creates a checkout session with your API key (POST /api/v1/checkouts), and the browser opens its URL in a modal. The API key never reaches the browser.

<!-- Include the EmbPay modal SDK -->
<script src="https://www.embpay.com/v1.js"></script>

<script>
  document.querySelector('#buy').addEventListener('click', async () => {
    // Your server endpoint: creates the session and returns { url }
    const res = await fetch('/api/checkout', { method: 'POST' });
    const { url } = await res.json();

    EmbPay.open(url, {
      onSuccess: (sessionId) => {
        // Confirm server-side with GET /api/v1/checkouts/{id} before fulfilling
        location.href = '/thanks';
      },
      onCancel: () => {
        console.log('Checkout cancelled');
      },
    });
  });
</script>

Webhooks

Listen for events in real-time

Webhooks allow you to receive real-time notifications when events occur in your account. Configure webhook endpoints in your dashboard settings.

Example Webhook Payload

{
  "id": "evt_9f2c1a7b4d8e",
  "event": "order.completed",
  "createdAt": "2026-02-08T14:30:00.000Z",
  "data": {
    "orderId": "cmsdkd1450001jr04u42ofsja",
    "amount": 4900,
    "currency": "usd",
    "status": "completed",
    "customerEmail": "customer@example.com",
    "customerName": "John Doe",
    "orderType": "purchase",
    "productId": "cmsdkggko0003jr0428cxqhko",
    "productName": "Premium Ebook"
  }
}

Webhook Events

order.completed
order.refunded
order.failed
subscription.created
subscription.renewed
subscription.payment_failed
subscription.canceled

Webhook Verification

Verify webhook signatures to ensure requests are from EmbPay:

// Header format: X-EmbPay-Signature: t=<unix>,v1=<hex>
// The digest covers "<timestamp>.<raw body>" — sign the RAW bytes,
// before any JSON parsing, or it will not match.
const header = req.headers['x-embpay-signature'];
const [tPart, v1Part] = header.split(',');
const timestamp = tPart.split('=')[1];
const received = v1Part.split('=')[1];

const expected = crypto
  .createHmac('sha256', ENDPOINT_SECRET)   // embp_whsec_… shown once at creation
  .update(`${timestamp}.${rawBody}`)
  .digest('hex');

const ok =
  received.length === expected.length &&
  crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));

if (!ok) throw new Error('Invalid webhook signature');

API Endpoints

GET/pingCheck a key and connection
GET/productsList products (?q, ?source, ?include_inactive)
POST/productsCreate or update a product by external_id
GET/products/:external_idRead a product (external_id or EmbPay id)
DELETE/products/:external_idDeactivate a product
POST/checkoutsCreate a checkout session
GET/checkoutsList sessions (?status, ?since, ?woo_order_id, ?customer_email)
GET/checkouts/:idRead a checkout session
POST/checkouts/:id/confirmConfirm a checkout session
POST/refundsRefund a checkout session, fully or partially
GET/eventsPull the event log for reconciliation
POST/webhook_endpointsRegister a webhook endpoint
DELETE/webhook_endpointsRemove a webhook endpoint

MCP server for AI assistants

The same API key also unlocks a remote MCP server at https://www.embpay.com/mcp. Claude Code, Claude Desktop, Cursor and Copilot can list orders, create products and checkout links, and refund on your say-so.

Set up the MCP server

Need More Help?

Our team is ready to assist with your integration.