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: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.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.organization: "acme-corp" with companyCode: "MX-S-12345".
Quick start
- Script tag
- Data-attrs
- React
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.
Filter payment methods (beta)
By default, the widget shows every payment method your company has enabled. If you want your user to see only some of them, pass thepaymentMethods option with the list of methods to show.
- Script tag
- Data-attrs
- React
How it behaves:
- It only restricts. The widget shows the methods you asked for that your company has enabled. It never enables a method your company does not have.
- Tapipay defines the order, not the order of your list.
- If no method is left, the widget shows a βNo payment methods availableβ message.
- If you omit the option or pass an empty list, every enabled method is shown.
- A single method: for example, with
paymentMethods: ["CARD"]your user only sees card. This way you can have one button per payment method on your site and open the widget with the method they picked. - It only applies to the payments view, not to
view: "autopay". It is independent from thepaymentMethodsfield of subscriptions.
This option is in beta and applies when the widget mounts. If you want to change the methods with the widget already mounted and know whether the checkout applied the filter, use
setPaymentMethods from the app β SDK channel. Both options coexist: this one keeps working the same.destroy(container)
Unmounts the widget: removes the iframe, the skeleton and the internal listeners.
<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
Payloads
CoDi events
With CoDi, your user enters the phone number linked to their mobile banking, Tapipay sends them a payment request and your user authorizes it from their bankβs app. Both events come from the payment methods view and never include the full phone number, onlylastFour.
codiPhoneFilled: the phone number entered is valid (10 digits). It is only compared against the last number reported: if your user deletes a digit and types the same number again, it is not repeated, but the sequence A β B β A emits three times.codiPaymentSubmitted: Tapipay accepted the request and sent it to your userβs bank. It does not fire on the button click: if sending fails or the result is uncertain, it does not arrive.amountis an integer, because CoDi rounds up.
@npmtapi/embed 1.12.0. With an earlier version of the package they still arrive, because the checkout script is the same, but without the TypeScript types.
In React
Events are passed as props. Watch out for the third name: the event is calledpaymentCancelled, but the prop is onCancelled.
<TapipayWidget /> also accepts every initialize() option (except container), plus environment, className and style for the container.
Channel with the checkout
Since@npmtapi/embed 1.10.0, tapipay.channel gives you a two-way channel with the mounted checkout: you prefill the direct debit CLABE and account holder, limit payment methods with the widget already mounted and receive payment.submitted, with a response (ack or an error with a code) for every piece of data you send.
App β SDK channel
Capabilities, how to enable it, responses and errors, and the full API.
Other frameworks
- Next.js
- Vue 3
- Angular
"use client".Staging environment
- npm
- React
- Script tag
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:

