This guide explains how to use your own payment processor with the Zendit embeddable widget.
With a custom payment processor, Zendit does not connect to your processor. You collect the payment. Zendit delivers the product after you tell Zendit that the payment is successful.
The flow has these steps:
Zendit does not refund a custom payment. If the transaction fails after the customer paid, you must refund the customer in your own payment system. Use the status in the product webhook to decide.
The widget currently sells eSIM products only. The webhook and the API are the same for all future supported product types.
Getting started with Bring Your Own Processor has a few requirements to meet and setup steps as explained in this section.
We recommend you familiarize yourself with the Zendit eSIM, Security and Webhook Guides.
Do these steps in this sequence:
A custom payment processor allows all available currencies. The widget offers each currency that you enabled in your foreign currency (FX) configuration. If FX is disabled for your account, the widget offers your account currency only.
The price that Zendit sends to you is in the currency that the customer selected.
See our Currency Mangement Guide for more information.
Zendit sends this webhook when a customer selects Pay. Your server prepares a payment and returns the URL of your payment form.
Register the webhook in the client console, on the webhooks screen, with the type Payment Request. The API name of the type is paymentRequest.
Once your webhook is registered, it will be available for use for Zendit to call when a customer checks out their purchase.
Zendit sends POST to your URL with these headers:
Content-Type: application/json
Accept: application/json
<your optional header>
The Payment Request body takes the following form:
{
"transactionId": "a1b2c3d4",
"offerId": "ESIM-US-5GB-30D",
"productType": "ESIM",
"brand": "ZENDIT-ESIM",
"brandName": "Zendit eSIM",
"country": "US",
"regions": [],
"subTypes": ["Bundle"],
"price": 1999,
"priceCurrency": "USD",
"priceCurrencyDivisor": 100,
"ipAddress": "203.0.113.7",
"createdAt": "2026-09-17T10:04:11.123456789Z",
"metadata": [
{ "key": "customerRef", "value": "TC-778120" }
]
}
The definition of the fields in the webhook are as follows:
| Field | Type | Description |
|---|---|---|
| transactionId | string | The transaction ID. Use it when you send the payment result. |
| offerId | string | The Zendit offer ID. |
| productType | string | ESIM, TOPUP, VOUCHER or BILLPAY. The product sent depends on the embeddable. For the eSIM embeddable the product type will be ESIM |
| brand | string | The brand code of the product. |
| brandName | string | The full brand display name. |
| country | string | The ISO country code of the product destination. Empty for a regional product. |
| regions | array of strings | The regions of the product. Always present. Can be empty. |
| price | integer | The total price that the customer must pay, in minor units. It includes fees. It is the price that the widget shows. |
| priceCurrency | string | The ISO 4217 code of the price currency. This is the currency that the customer selected. |
| priceCurrencyDivisor | integer | The currency divisor of priceCurrency. |
| ipAddress | string | The IP address of the customer. It can be empty. |
| createdAt | string | The time when Zendit made the transaction. RFC 3339 format, UTC. It can contain fractions of a second. |
| metadata | array of objects | Key/value pairs from the widget checkout. Not present when the checkout has no metadata. See 3.3. |
All fields except metadata are always present.
The widget can send key/value pairs with the checkout. Zendit sends them to you without changes:
Limits:
If the checkout breaks a limit, Zendit rejects the checkout. Zendit does not send the webhook.
Zendit does not keep the metadata after the Payment Request. The metadata comes from the browser of the customer. Do not use it to identify who pays without a check in your own system.
To add metadata to your embeddable, please see the embedded eSIM Guide for an example.
Return HTTP 200 with a JSON body:
{
"paymentReference": "PMT-2026-0917-8891",
"paymentUrl": "https://pay.example.com/form/8891",
"currency": "USD",
"paymentAmount": 1999,
"expiresAt": "2026-09-17T10:19:11Z"
}
The fields in your response explained:
| Field | Type | Description |
|---|---|---|
| paymentReference | string | Your reference for this payment. You must send the same value with the payment result. REQUIRED |
| paymentUrl | string | The URL of your payment form. It must be an absolute https:// URL. REQUIRED |
| currency | string | The currency of the payment. If you send it, it must be the same as priceCurrency in the request. OPTIONAL |
| paymentAmount | integer | The amount that you will collect, in minor units. It must be an integer. OPTIONAL |
| expiresAt | string | The time when your payment form stops working. RFC 3339 format with a time zone. It must be in the future. OPTIONAL |
Zendit ignores fields that it does not know.
Zendit always debits your wallet for the price that it quoted. paymentAmount does not change the debit. Zendit uses paymentAmount for reporting when your payment result has no usable amount (see 5.4).
Zendit does not retry the Payment Request. Zendit sends it one time for each checkout.
Return the response as quickly as possible. The customer waits for it. Return it in less than 10 seconds. A slower response can make the checkout fail in the widget.
Each of these conditions makes the transaction fail immediately:
The widget then shows a checkout error. Zendit does not debit your wallet. Zendit sends a product webhook with the status FAILED. That webhook has no payment object.
The transaction error has the code CUSTOM_PAYMENT_FAILED and the description “Failed to collect the custom payment”. The message tells you the cause:
| Cause | Message |
|---|---|
| No response in time | The Payment Request webhook timed out |
| Connection failure | The Payment Request webhook is unreachable |
| Body cannot be decoded | The Payment Request webhook response is not valid JSON |
| Status other than 200 | The Payment Request webhook answered [<status>] |
| No payment reference | The Payment Request webhook response has no paymentReference |
| No payment URL | The Payment Request webhook response has no paymentUrl |
| URL is not https | The Payment Request webhook response paymentUrl is not an absolute https URL |
| Expiry in the past | The Payment Request webhook returned an expiresAt in the past |
| Wrong currency | The Payment Request webhook returned a different currency: <yours>, not the requested <quoted> |
The message “not valid JSON” also covers a field with the wrong type.
If no production Payment Request webhook is registered, the transaction fails with the code EMBED_PAYMENT_PROVIDER_NOT_CONFIGURED.
In the case that a customer enters the embeddable without any critical metadata needed or prechecks on the transaction by your payment system, the transaction may be blocked by sending a non 200 response code.
In this case, the transaction will be held open for 60 minutes on Zendit’s side and then failed.
The widget loads paymentUrl in an IFRAME. Your form must obey these rules:
The widget loads paymentUrl as you return it. It does not send headers or tokens to your form. If your form needs authentication, put it in paymentUrl. For example, add a single-use token to the query string.
paymentUrl goes to the browser of the customer. Make a token in it short-lived, and limit it to this one payment.
Your form must tell the widget what happens. Send a message to the parent window with postMessage:
const ZENDIT_ORIGIN = 'https://embed.zendit.io'; // IFRAME integration. For the HTML integration, use the origin of your page.
const zenditEmbedEvents = {
_send: (type) => window.parent.postMessage(
{ source: 'zendit-custom-processor', type, version: 1 },
ZENDIT_ORIGIN
),
cancel() { this._send('payment.cancelled'); },
submit() { this._send('payment.submitted'); },
expire() { this._send('payment.expired'); }
};
Definitions of the events that the form must expose:
| Event | When to Send It | What the Widget Does |
|---|---|---|
| payment.cancelled | The customer cancels the payment. | It closes the form and shows the checkout page again. REQUIRED |
| payment.submitted | Your form has sent the payment to your processor. | It closes the form and shows a progress screen. It then waits for the transaction result. REQUIRED |
| payment.expired | Your payment session has expired. | It closes the form and tells the customer that the payment expired. The customer can go back to the checkout. OPTIONAL |
source must be zendit-custom-processor.
Send the message from the page in the IFRAME. The widget ignores messages from other windows, for example a 3-D Secure popup.
After 3-D Secure, your form can return on a different domain. This is permitted. Send the event from the page that is then in the IFRAME.
The widget uses the first event only. It ignores all events that come after it.
payment.submitted does not tell the widget that the payment is successful. Only your payment result (section 5) tells Zendit the result.
If you return expiresAt, the widget closes the form at that time. It shows the expired message. You do not have to send payment.expired in this case.
If the customer cancels, Zendit does not get a payment result. The transaction expires (see 5.5). A new checkout makes a new transaction.
When your processor has finished the payment, your backend sends the result to Zendit.
POST https://api.zendit.io/v1/transactions/{transactionId}/payment
Authorization: Bearer <your production API key>
Content-Type: application/json
{transactionId} is the transactionId from the Payment Request webhook.
The usual API rules apply. Use the API key of the wallet that made the transaction. Send the request from a whitelisted IP address. You can send results only for the transactions of your own wallet.
{
"paymentReference": "PMT-2026-0917-8891",
"paymentStatus": "SUCCESS",
"paymentAmount": 1999,
"paymentCurrency": "USD",
"customerReferenceId": "cust-55120"
}
Explanation of fields to include in the request body for the payment call:
| Field | Type | Description |
|---|---|---|
| paymentReference | string | The paymentReference from your Payment Request response. It must be exactly the same, with the same letter case. REQUIRED |
| paymentStatus | string | SUCCESS or FAILURE. Use capital letters. REQUIRED |
| paymentAmount | integer | The amount that the customer paid, in minor units. It cannot be negative. This value is used if the price was adjusted from the original payment request. OPTIONAL |
| paymentCurrency | string | The ISO 4217 code of the currency that the customer paid in. This value is used if the price was adjusted from the original payment request. OPTIONAL |
| customerReferenceId | string | Your own ID for the customer. Zendit sends it back in the product webhook. OPTIONAL |
Send paymentAmount and paymentCurrency together, or do not send them. Zendit ignores fields that it does not know.
| Status | Meaning | What to do |
|---|---|---|
| 200, empty body | Zendit accepted the report. | Stop. Wait for the product webhook. |
| 400 validation_error | The request is not correct. | Do not retry the same request. Correct it. |
| 404 not_found | Zendit cannot find the transaction for your wallet. | Do not retry. Check the transaction ID and the API key. |
| 401 unauthorized | The API Key is not recognized | Correct your configuration. Then retry. |
| 403 forbidden | IP Address request is from is not whitelisted | Correct your configuration. Then retry. Requests from IP Addresses not in your whitelist will be blocked. |
| Other statuses, for example 409 or 5xx | Zendit did not accept the request. | Retry until you get 200. |
Zendit returns 200 each time it accepts a report, also when the report does not change the transaction. For example:
You send the same result again.
You send a result after you already sent a different result.
The transaction has already failed or expired.
You send SUCCESS after the payment deadline (see 5.5).
The response does not tell you the transaction result. The product webhook tells you the result.
Error responses have this body:
{ "message": "INVALID_VALUE: paymentStatus: must be one of SUCCESS, FAILURE", "errorCode": "validation_error", "fields": {} }
Zendit returns validation_error (400) for these conditions:
The body is not valid JSON, or a field has the wrong type. For example, paymentAmount is a decimal number.
paymentReference is missing.
paymentStatus is not SUCCESS or FAILURE.
Only one of paymentAmount or paymentCurrency is present.
paymentAmount is negative.
paymentCurrency is not an ISO 4217 code.
The transaction is not paid through a custom payment processor.
paymentReference is not the same as the reference of the transaction.
SUCCESS reported on the API Call:
Zendit records the payment as paid. It records your customerReferenceId, if present.
Zendit debits your wallet for the quoted price.
Zendit delivers the product.
The transaction becomes DONE, or FAILED if the delivery fails.
The debit can fail, for example when your wallet balance is too low. The transaction then fails after the customer has paid. You must refund the customer.
FAILURE, reported on the API Call:
Zendit records the payment as failed. It records your customerReferenceId, if present.
The transaction becomes FAILED with the code CUSTOM_PAYMENT_FAILED and the message payment failed. Zendit does not debit your wallet.
Zendit applies only the first result for a transaction. It ignores all results that come after it. The transaction can not be retried for fulfillment and requires a new transaction to be handled if the Zendit transaction has failed.
If your reported currency is different from the quoted currency, Zendit records the payment as paid. Zendit does not reject it, because you have already taken the money. This amount is owed to the customer in a failed Zendit transaction and will be returned on the final webhook.
Zendit updates the customer price of the transaction from the payment. This is for reporting only. Your wallet debit does not change. Zendit uses the first of these values that is available:
If Zendit does not get a result, the transaction expires. The deadline is:
1 hour after the transaction was made, when you do not return expiresAt;
5 minutes after expiresAt, when you return it. The deadline is never more than 1 hour after the transaction was made.
Zendit ignores a SUCCESS result. It returns 200, but it does not deliver the product.
The transaction becomes FAILED with the code CUSTOM_PAYMENT_FAILED and the message payment expired. The status can change a short time after the deadline.
if you take the money after the deadline, Zendit does not deliver the product. You must refund the customer. Make sure that your payment session ends before the deadline.
Zendit sends the usual product webhooks (eSIM, top-up, voucher, bill pay) for a custom payment transaction. Zendit sends them when the transaction is IN_PROGRESS, DONE or FAILED.
The webhook has a top-level payment object:
"payment": {
"reference": "PMT-2026-0917-8891",
"amount": 1999,
"currency": "USD",
"currencyDivisor": 100,
"customerReferenceId": "cust-55120"
}
Explanation of payment node in webhook:
| Field | Present | Description |
|---|---|---|
| reference | Always | Your paymentReference |
| amount | When the payment is paid | The customer price of the transaction in minor units, after the update in reported price. |
| currency | When the payment is paid | The quoted currency. |
| currencyDivisor | When the payment is paid | The currency divisor of currency. |
| customerReferenceId | If provided by you | Your customer ID from the payment result. |
What the object contains in each case:
| Case | Webhook Status | payment Object |
|---|---|---|
| Payment Request failed at checkout | FAILED | Not present |
| You reported FAILURE | FAILED | reference, and customerReferenceId if sent |
| The payment expired | FAILED | reference |
| You reported SUCCESS, then delivery failed | FAILED | All fields |
| You reported SUCCESS, and the delivery is successful | DONE | All fields |
The payment object is only present for purchases made through the Zendit Embeddable.
Zendit does not refund a custom payment. Use the product webhook:
DONE — complete the payment in your system.
FAILED with a paid payment (amount is present) — refund the customer.
The purchase APIs also return the payment object, with the same rules. For example: GET /v1/esim/purchases/{transactionId}. The same applies to the top-up, voucher and bill pay purchase APIs.
A custom payment transaction has these statuses:
| Status | Meaning |
|---|---|
| PENDING | Zendit waits for your payment result. |
| AUTHORIZED | You reported SUCCESS. Zendit debited your wallet. |
| IN_PROGRESS | Zendit delivers the product. |
| DONE | The product is delivered. |
| FAILED | The transaction failed. The error object tells you why. |
Once you have completed all the steps for setting up the Webhooks, you can select the Bring Your Own Payments processor for payments in Zendit Embeddable. You can test your integration in multiple scenarios keeping in mind that a limited amount of test credits can be issued to help with testing since embeddable only works with live product. To setup your payment method, return to the Embedded Payments Setup screen and select the Custom Processor. Selecting the Use Custom Processor will switch to using the webhook and API driven methods with your form for payments.
