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.
Integration Scenario Demo
Embedding a Complete Checkout Page:

Demo of embedding a complete page
Embedding Partial Components:

Demo of embedding partial components
Checkout Flow
- 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.
sequenceDiagram participant Customer as Customer participant Client as Merchant Client participant Server as Merchant Server participant SubotizAPI as Subotiz API Customer->>Client: 1. Initiate Order Client->>Server: 2. Request session ID Server->>SubotizAPI: 3. Create Checkout Session SubotizAPI-->>Server: 4. Return session information Server-->>Client: 5. Return session id Client->>Client: 6. Invoke Form Using SDKs Client-->>Customer: 7. Display Payment Form Customer->>Client: 8. Enter Payment Information & Confirm Client->>Client: 9. Process Payment Client-->>Customer: 10. Return Payment Result SubotizAPI->>Server: Webhook Noification with Payment Result
Integration Steps
Step 1: Create Products
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 pricing_id
of the product pricing to dynamically retrieve product information.
Create a Product:

Create Product Pricing:

Step 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.
Step 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.
Step 4: Integrate the Embedded Form
Your client-side application can use the Subotiz SDK to integrate Subotiz Checkout.
1. Load Subotiz.js
<script src="https://checkout.subotiz.com/static/subotiz/v0/subotiz.js"></script>
2. Provide a Container Node
<div id="your_domElement">
<!-- The checkout page will be displayed here -->
</div>
3. Create Checkout Session
Use the Subotiz API to create a Checkout Session , and return the response to your frontend.
Example: Creating a Checkout Session in Embedded Mode
curl --location 'https://api.subotiz.com/api/v1/session' \
--header 'Content-Type: application/json' \
--header 'Hub-Timestamp: 1755695704350' \
--header 'Hub-Access-No: 77d52a21dc032b4' \
--header 'Request-Id: dd7fb126-be31-4144-a1af-e4bf4203eb92' \
--header 'Hub-Signature: 4830f629ff065be043c4f4b2f908ef6418d18e4ef9d6a288313ded21f1b0ec13' \
--data-raw '{
"access_no": "77d52a21dc032b4",
"sub_merchant_id": "2816433",
"order_id": "123e4567-e89b-12-a456-426622201a",
"payer_id": "customer_id_001",
"customer_id": "",
"email": "[email protected]",
"line_items": [ # Product info (required for checkout mode)
{
"price_id": "543321366326164797",
"quantity": "1"
}
],
"return_url": "https://www.subotiz.com",
"cancel_url": "https://www.subotiz.com",
"callback_url": "https://webhook.site/2c889bcb-9923-4551-909a-d827f1c326e3",
"mode": "checkout", # Choose 'checkout' mode when product data is present
"integration_method": "embedded", # Select embedded integration
"redirect_on_completion": "if_required" # Choose redirection behavior based on business needs; this example redirects only when necessary
}'
Key Parameters:
order_id
: Your platform's internal order ID, used for subsequent business data correlation.integration_method
: Set toembedded
to use the embedded form integration method.return_url
: The URL the customer is redirected to after a successful payment.mode
: Choosecheckout
mode when product data is present.
4. Initialize the Checkout Page
// After importing via the script tag, Subotiz is automatically attached to the window object
const { Subotiz } = window;
// Create an SDK instance
const subotiz = Subotiz();
// Initialize checkout
const checkout = await subotiz.initEmbeddedCheckout({
fetchSessionId: async () => {
// Fetch the sessionId from your server
const response = await fetch('/api/session');
const data = await response.json();
return data.sessionId;
},
environment: 'TEST', // 'TEST' | '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 page
checkout.mount('#your_domElement');