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://api.embpay.io/v1JSONBearer TokenCreate a Product
POST /products
Request
curl -X POST https://api.embpay.io/v1/products \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Premium Ebook",
"description": "A comprehensive guide to digital marketing",
"price": 4900,
"currency": "usd",
"type": "digital",
"files": ["ebook.pdf"]
}'Response
{
"id": "prod_abc123xyz",
"name": "Premium Ebook",
"description": "A comprehensive guide to digital marketing",
"price": 4900,
"currency": "usd",
"type": "digital",
"status": "active",
"created_at": "2026-02-08T14:30:00Z",
"checkout_url": "https://embpay.io/checkout/prod_abc123xyz",
"embed_code": "<script src='https://embpay.io/embed/prod_abc123xyz.js'></script>"
}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 Checkout Button -->
<script
src="https://embpay.io/embed/PROD_ID.js"
data-button-text="Buy Now"
data-button-class="custom-class"
></script>Embed Options
data-button-textButton labeldata-button-classCSS class namesdata-success-urlRedirect after purchasedata-themelight | dark | autoJavaScript SDK
For advanced integrations
<!-- Include the EmbPay SDK -->
<script src="https://embpay.io/sdk/v1.js"></script>
<script>
// Initialize the SDK
const embpay = new EmbPay('YOUR_API_KEY');
// Open checkout modal
embpay.checkout({
productId: 'prod_abc123xyz',
onSuccess: (result) => {
console.log('Payment successful!', result);
// Redirect or show success message
},
onCancel: () => {
console.log('Checkout cancelled');
},
onError: (error) => {
console.error('Payment error:', error);
}
});
</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_abc123xyz",
"type": "order.completed",
"created": 1699455600,
"data": {
"order": {
"id": "ord_def456uvw",
"product_id": "prod_abc123xyz",
"product_name": "Premium Ebook",
"amount": 4900,
"currency": "usd",
"customer_email": "customer@example.com",
"customer_name": "John Doe",
"status": "completed",
"created_at": "2026-02-08T14:30:00Z"
}
}
}Webhook Events
order.completedorder.refundedproduct.createdproduct.updatedWebhook Verification
Verify webhook signatures to ensure requests are from EmbPay:
const signature = req.headers['x-embpay-signature'];
const payload = JSON.stringify(req.body);
const expected = crypto
.createHmac('sha256', WEBHOOK_SECRET)
.update(payload)
.digest('hex');
if (signature !== expected) {
throw new Error('Invalid webhook signature');
}API Endpoints
/productsList all products/productsCreate a new product/products/:idGet a specific product/products/:idUpdate a product/products/:idDelete a product/ordersList all orders/orders/:idGet a specific order/orders/:id/refundRefund an orderNeed More Help?
Our team is ready to assist with your integration.