Integrate Centry Checkout into your website in minutes.
Monthly access to all features
1. Include the Centry Checkout script:
<script src="https://checkout.centry.io/widget/centry-checkout.js"></script>
2. Create a checkout session via your backend:
// Server-side (Node.js example)
const response = await fetch('https://api.centry.io/api/v1/checkout/sessions/', {
method: 'POST',
headers: {
'Authorization': `Api-Key ${YOUR_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '5000.00',
currency: 'NGN',
reference: 'ORDER-123',
success_url: 'https://yoursite.com/success',
cancel_url: 'https://yoursite.com/cancel',
customer_email: 'customer@example.com'
})
});
const { session_token } = await response.json();
3. Open the checkout modal:
CentryCheckout.open({
sessionToken: 'your-session-token',
onSuccess: function() {
console.log('Payment successful!');
// Redirect to success page or update UI
},
onError: function(error) {
console.error('Payment failed:', error);
},
onClose: function() {
console.log('Checkout closed');
}
});
CentryCheckout.open(options)
{
sessionToken: string, // Required. The checkout session token
onSuccess: function, // Called when payment succeeds
onError: function(error), // Called when payment fails
onClose: function // Called when modal is closed
}
CentryCheckout.close()
Programmatically close the checkout modal.