Skip to main content
The embed SDK mounts the TapiPay payment widget inside your site. Unlike a manual iframe, it resizes itself, shows a skeleton while loading, and tells you through events what the user is doing. It is the same SDK used by autopay management: a single option (view) decides which screen you mount.

Installation

TypeScript types ship with the package. You do not need to install anything else.

Entrypoints

<TapipayWidget /> is the recommended path in React: it loads the SDK, mounts the widget and cleans it up on unmount. useTapipay() is the low level hook, for when you need to control initialize() and destroy() yourself. If you are not using a bundler, you do not need to install anything: load the script and work with window.tapipay.

Identify your company

Pass one of these two options, not both:
string
Your company’s slug or alias (for example, acme-corp). It matches the Alias field under Settings → Organization in the dashboard. In data-attrs: data-organization.
string
The company code configured for your organization in TapiPay (for example, MX-S-12345). The format varies between integrations: if you do not know yours, confirm it with your TapiPay contact. In data-attrs: data-company-code.
If you manage many companies or sub-billers, use companyCode: you do not need to know or maintain each company’s slug. If you pass both, companyCode wins.
Every example on this page works the same if you replace organization: "acme-corp" with companyCode: "MX-S-12345".

Quick start

No bundler. The script makes window.tapipay available once loaded.

Options

initialize(options)

If container, identifier or both company identifiers are missing, the SDK mounts nothing and warns in the console.

destroy(container)

Unmounts the widget: removes the iframe, the skeleton and the internal listeners.
Calling it matters in a SPA, when unmounting the component that holds the widget. <TapipayWidget /> already does it for you. If you call initialize() again on a container that already has a widget, the SDK destroys it and mounts it again.

loadTapipay(options)

It is idempotent per environment: calling it several times returns the same promise and never injects the script twice. It is compatible with React Strict Mode.

Events

paymentSubmitted means submitted, not confirmed. Its status is always "pending": the user completed the form, but the payment is not settled yet. Never mark a debt as paid based on this event. The real status arrives through the payment notification to your backend.

Payloads

In React

Events are passed as props. Watch out for the third name: the event is called paymentCancelled, but the prop is onCancelled. <TapipayWidget /> also accepts every initialize() option (except container), plus environment, className and style for the container.

Other frameworks

The widget is a client component: it needs "use client".

Staging environment

What the SDK mounts

Knowing which URL the SDK builds helps you debug: if the widget stays blank, open that URL directly in the browser and you will see the real error. externalRequestId and selectionStrategy are added as query params. For example, initialize() with organization: "acme-corp", identifier: "CLI-00042" and externalRequestId: "INV-2026-001" mounts: