Integration Examples
Connect your website to TabEdge hosted checkout using server-side API requests. Keep your secret API key exclusively on your backend.
1. Configure Your Business
Complete Business onboarding, configure authorized redirect domains, and create a Business-scoped API key in Developer Settings. Use the key matching your intended environment.
2. Create Checkout on Your Backend
Calculate the order amount on your server. Never trust an amount submitted directly by the customer.
const response = await fetch(
'https://www.tabedge.com/api/platform/v1/checkout-sessions',
{
method: 'POST',
headers: {
Authorization: 'Bearer ' + process.env.TABEDGE_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amountCents: 2500,
currency: 'usd',
description: 'Order #1001',
successUrl: 'https://merchant.example/success',
cancelUrl: 'https://merchant.example/cancel',
merchantReference: 'ORDER-1001',
}),
}
);
if (!response.ok) {
throw new Error('Checkout creation failed');
}
const { checkoutId, checkoutUrl } = await response.json();
// Save checkoutId against your order on your server.
// Return checkoutUrl to your frontend for redirect.3. Redirect Your Customer
Send the returned checkoutUrl to your frontend and redirect the customer to the TabEdge hosted payment page. Save the checkoutId against your internal order before redirecting.
4. Verify Payment on Your Backend
After checkout, retrieve the status using your secret API key. Match the checkout status, amount, currency, and order reference before fulfilling the order.
const response = await fetch(
'https://www.tabedge.com/api/platform/v1/checkouts/' + checkoutId,
{
headers: {
Authorization: 'Bearer ' + process.env.TABEDGE_API_KEY,
},
}
);
if (!response.ok) {
throw new Error('Checkout verification failed');
}
const checkout = await response.json();
const verified =
checkout.status === 'paid' &&
checkout.amountCents === expectedAmountCents &&
checkout.currency === 'usd' &&
checkout.merchantReference === expectedOrderReference;
// Fulfill only after verified is true.
// Make fulfillment idempotent using your order ID.A customer visiting the success URL does not independently prove that payment succeeded.
5. Handle Merchant Webhooks
Configure an HTTPS webhook endpoint, verify the HMAC signature using the raw request body, and process checkout.payment_succeeded events idempotently. Webhooks may be retried, so duplicate delivery must not cause duplicate order fulfillment.
Read Webhook Documentation →Production Checklist
- Keep secret API keys in server environment variables.
- Validate prices and order ownership on your backend.
- Use authorized HTTPS redirect domains.
- Verify checkout status before fulfilling an order.
- Validate webhook signatures and prevent replay.
- Make order fulfillment idempotent.
- Log API errors without exposing credentials.