Subotiz supports completing the checkout process through an embedded form (Embedded Mode). It provides a low-code payment integration solution, allowing you to easily create customizable payment forms and quickly implement the checkout flow.
This page explains how to implement the Embedded Checkout integration. This method enables you to rapidly implement an integrated checkout experience by leveraging Subotiz’s product, pricing, and payment capabilities.If you only need to integrate payment processing, please refer to Payment Mode.
When a customer is ready to complete a purchase, initiate a checkout request from your client-side application to your server. Your server should use the Subotiz API to create a Checkout Session, passing the order_id (your platform’s unique order identifier) as a parameter to facilitate subsequent association with the trade order.
The Checkout Session will provide a Session ID. Your client-side application can then use the SDKs to invoke and display the Subotiz payment form to the customer.
The customer will enter their payment details into the Subotiz form and complete the transaction.
After the transaction is completed, Subotiz will notify your server via a webhook. This notification includes a payment success event containing the order_id passed during session creation, enabling you to correlate your platform’s order with Subotiz’s trade order.
Create products and product pricing within the Subotiz merchant platform. Store the product and price information on your server. Creating a Checkout Session relies on the price_id of the product pricing to dynamically retrieve product information.
Create a Product
Create Product Pricing
2
Provide a Payment Success Page
Your application needs to provide a publicly accessible page to display after a successful payment. After the customer completes the payment, Subotiz will redirect them to this page.
3
Provide a Webhook Endpoint
Create an endpoint to receive events for your account. When an event occurs, Subotiz will send an HTTPS POST request containing a JSON-formatted event object to this Webhook endpoint. You can use these events to keep your system’s business data in sync.
4
Integrate the Embedded Form
Your client-side application can use the Subotiz SDK to integrate Subotiz Checkout.
// After importing via the script tag, Subotiz is automatically attached to the window objectconst { Subotiz} = window;// Create an SDK instanceconst subotiz = Subotiz();// Initialize checkoutconst checkout = await subotiz.initEmbeddedCheckout({ fetchSessionUrl: async() => { // Fetch the sessionUrl from your server const response = await fetch('/api/session'); const data = await response.json(); return data.sessionUrl; }, environment: 'SANDBOX',// 'SANDBOX' | 'PRODUCTION' // The callback function when the payment completed only triggers when `redirect_on_completion` is set to `if_required` during Checkout session creation onComplete: () => { console.log('Payment completed!'); }});// Mount to the pagecheckout.mount('#checkout-container');