View
The methods they have enrolled: card or CLABE account.
Enroll
A new method, when they do not have one yet.
Remove
An existing method.
destroy(). The two differences are that it mounts with view: "autopay" and that it emits its own events.
Installation, entrypoints,
loadTapipay() and the staging environment are identical. They are covered in Payment methods SDK.Quick start
- Script tag
- Data-attrs
- React
organization (the slug) or with companyCode. Replace organization: "acme-corp" with companyCode: "MX-S-12345" in any of the examples.
The view option
Every other option (
container, organization / companyCode, identifier, environment) is the same as in the payments view. externalRequestId and selectionStrategy do not apply here: they belong to the payments view.
The URL the SDK mounts is the payments view URL with /autopay appended:
Events
Payloads
mediaType tells the enrolled method apart: card is a credit card, bank_account is a CLABE account and debit_card is a debit card.
In React
Enrollment flow events
When the user does not have an enrolled method yet, theautopay view opens the enrollment flow inside the same iframe. That flow emits its own events, one per step the user completes, so you can follow their progress from your site.
These are interface milestones: they tell you what the user completed in the widget, not what the backend confirmed. The enrollment is processed asynchronously, so the confirmation that it became active arrives through
autopayActivated.1
domiciliationBankSelected
The user picked their bank.
2
domiciliationFormCompleted
The account details passed backend validation.
3
domiciliationVerificationCompleted
Account verification finished.
4
domiciliationConfirmed
The user confirmed the enrollment.
domiciliationAccountCheckFailed, is not part of that sequence: it is an error event that can fire zero, one or many times while the user types their CLABE or card number. It is the equivalent of autopayError for this flow.
Underneath, these events are
postMessage messages the iframe emits. If you embed it by hand, without the SDK, you can listen to them directly: see postMessage events.Payloads
domiciliationAccountCheckFailed reasons
The CLABE or card the user typed never travels, and neither does the error message they see on screen (that text belongs to the interface and can change without notice). Only the selected bank and the categorized reason.
In React
How it relates to the API
A subscription created withautopay: true is charged through autopay, without the user picking a method on every charge. In direct debit (POST /v2/debts) the debt does not carry autopay: it is debited automatically if it references a product and the user has an enrolled default method. For that charge to work, the user needs an enrolled method: this screen is where they enroll it.
Payment methods and autopay
How
autopay works on debts and subscriptions, and how it relates to paymentMethods.
