Integrate a seamless cryptocurrency checkout experience directly into your website or application.
ZenPay Custom Checkout provides a complete, customizable checkout solution that integrates directly into your website. Unlike payment buttons or checkout links, Custom Checkout gives you full control over the payment experience while maintaining security and ease of use.
Keep customers on your website throughout the payment process.
Tailor the checkout UI to match your website design.
Built with developers in mind for easy integration.
Security built in at every layer.
ZenPay Custom Checkout offers two main integration approaches to suit different development needs:
The fastest way to integrate ZenPay's Custom Checkout
This option provides a pre-built checkout UI that you can customize with your colors and branding.
Complete control over the checkout experience
For developers who want complete control over the checkout experience using ZenPay's SDK components.
Here's how to quickly integrate ZenPay's Drop-in Checkout:
// 1. Include ZenPay.js on your page
<script src="https://js.zenpay.io/v1/zenpay.js"></script>
// 2. Configure your checkout
<script>
document.addEventListener('DOMContentLoaded', function() {
const zenpay = new ZenPay('pk_test_YourPublicKey');
document.getElementById('pay-button').addEventListener('click', async () => {
try {
// Create a checkout session
const session = await zenpay.createCheckoutSession({
amount: 99.99,
currency: 'USD',
product_name: 'Premium Membership',
customer_email: 'customer@example.com',
success_url: window.location.origin + '/thank-you',
cancel_url: window.location.origin + '/cart'
});
// Launch the checkout modal
zenpay.showCheckout(session.id, {
theme: {
colorPrimary: '#4F46E5',
colorBackground: '#FFFFFF',
colorText: '#1F2937',
borderRadius: '8px',
fontFamily: 'Inter, sans-serif'
}
});
} catch (error) {
console.error('Error creating checkout session:', error);
}
});
});
</script>
// 3. Add a button to trigger checkout
<button id="pay-button" class="payment-button">Pay with Crypto</button>For complete control over the checkout experience using React:
// First, install the ZenPay React SDK
// npm install @zenpay/react
import React, { useState } from 'react';
import {
ZenPayProvider,
useZenPay,
CryptoPaymentForm,
CryptoMethodSelector,
CheckoutSummary,
PaymentStatus
} from '@zenpay/react';
// Your checkout component
function CustomCheckout({ amount, currency, productName }) {
const [paymentStatus, setPaymentStatus] = useState('idle');
const [selectedMethod, setSelectedMethod] = useState(null);
const { createPayment, getPaymentStatus } = useZenPay();
const handleSubmit = async () => {
try {
setPaymentStatus('processing');
// Create a payment with ZenPay
const payment = await createPayment({
amount,
currency,
product_name: productName,
payment_method: selectedMethod,
metadata: {
customer_id: 'cust_123456', // Your internal customer ID
order_id: 'ord_789012' // Your internal order ID
}
});
// Poll for payment status
const statusInterval = setInterval(async () => {
const status = await getPaymentStatus(payment.id);
if (status === 'completed') {
setPaymentStatus('success');
clearInterval(statusInterval);
} else if (status === 'failed') {
setPaymentStatus('error');
clearInterval(statusInterval);
}
}, 5000);
} catch (error) {
console.error('Payment error:', error);
setPaymentStatus('error');
}
};
return (
<div className="checkout-container">
<CheckoutSummary
amount={amount}
currency={currency}
productName={productName}
/>
<CryptoMethodSelector
onChange={method => setSelectedMethod(method)}
selectedMethod={selectedMethod}
/>
{selectedMethod && (
<CryptoPaymentForm
method={selectedMethod}
onSubmit={handleSubmit}
/>
)}
{paymentStatus !== 'idle' && (
<PaymentStatus status={paymentStatus} />
)}
</div>
);
}
// Wrap your app with the provider
function App() {
return (
<ZenPayProvider apiKey="pk_test_YourPublicKey">
<CustomCheckout
amount={99.99}
currency="USD"
productName="Premium Membership"
/>
</ZenPayProvider>
);
}The Drop-in Checkout can be customized in several ways to match your website's design:
Adjust the visual appearance of the checkout:
Control how the checkout appears on your page: