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.
https://www.embpay.com/api/v1JSONBearer TokenCreate 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 labeldata-colorButton colour (hex)data-modepopup | redirect | embedThe 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.completedorder.refundedorder.failedsubscription.createdsubscription.renewedsubscription.payment_failedsubscription.canceledWebhook 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
/pingCheck a key and connection/productsList products (?q, ?source, ?include_inactive)/productsCreate or update a product by external_id/products/:external_idRead a product (external_id or EmbPay id)/products/:external_idDeactivate a product/checkoutsCreate a checkout session/checkoutsList sessions (?status, ?since, ?woo_order_id, ?customer_email)/checkouts/:idRead a checkout session/checkouts/:id/confirmConfirm a checkout session/refundsRefund a checkout session, fully or partially/eventsPull the event log for reconciliation/webhook_endpointsRegister a webhook endpoint/webhook_endpointsRemove a webhook endpointMCP 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.
Need More Help?
Our team is ready to assist with your integration.