Remitian Widget SDK
Embed Remitian portal experiences (tax payments, connectors, bank accounts) inside your own application through a modal, without redirecting your users to the Remitian portal.
How it works
The SDK is a thin layer: it opens a modal iframe pointing at the Remitian portal, delivers the flow parameters in a POST request body (never in the URL), and relays the portal's events back to your code as callbacks. Every session is authenticated: either your backend generates a passwordless token through the Remitian Public API, or the user logs in with their Remitian credentials inside the widget.
Going from zero to an open widget takes four steps:
- Install the SDK
- Generate a passwordless token (server-side)
- Create and open the widget
- Handle callbacks
1. Install
npm (bundlers)
npm install @remitian/widget-sdk
import * as Remitian from '@remitian/widget-sdk';
CDN (script tag)
<script src="https://cdn.remitian.com/widget-sdk/v1/remitian.js"></script>
<!-- exposes window.Remitian -->
The /v1/ channel URL receives patches automatically. Pin an exact version instead when your policy requires exact versions or Subresource Integrity: use the pinned URL and the sha384 hash published in the release notes. SRI cannot be used with the channel URL — the hash matches exactly one file and the channel file changes on release by design.
<script
src="https://cdn.remitian.com/widget-sdk/v1.1.0/remitian.js"
integrity="sha384-<hash from the release notes>"
crossorigin="anonymous"
></script>
2. Generate a passwordless token
Your backend generates a passwordless authentication token for the end user via the Remitian Public API and hands it to your frontend. The token lets the user skip the Remitian login inside the widget.
The token is optional. Without it, the widget shows the Remitian login and the user authenticates with their own credentials.
Never generate tokens from frontend code; the Public API credentials must stay on your server.
3. Create and open
Build the configuration with buildPayWithRemitianConfig: it takes the flow-specific and common parameters together and fixes the flow for you. Every resource is identified by your external id.
The payment (and its tax entity) must exist in Remitian before the widget opens: create them through the Public API. Since 1.2.0 the widget does not create resources. A payment that does not exist fires onError with tax_payments_not_found.
Single payment (the default): the widget handles only the payment you inform. The taxpayer connects the tax account of that payment if needed, picks the bank account if needed, reviews the payment and approves it.
const widget = Remitian.create(
Remitian.buildPayWithRemitianConfig({
passwordlessToken: 'xxxx', // optional; omit to let the user log in
environment: 'sandbox', // 'sandbox' | 'production' (default)
taxPayment: { externalId: 'my_tax_payment_123' }, // required
onSuccess: (result) => {}, // { flow, taxPayments: [{ externalId, id, status }], taxPayment (deprecated) }
onExit: (reason) => {},
onError: (error) => {},
onEvent: (event) => {},
}),
);
widget.open(); // shows the modal
widget.exit(); // closes the modal (reusable; open() again later)
widget.destroy(); // removes everything; the handler cannot be reused
Multiple payments: with multiplePayments: true the widget lists every payment of one tax entity that is pending approval, resolves the pending tax authority connections, picks the funding bank account and approves the payments in one session.
const widget = Remitian.create(
Remitian.buildPayWithRemitianConfig({
multiplePayments: true,
// Required. Only payments and connections of this tax entity are handled.
taxEntity: { externalId: 'my_tax_entity_123' },
// Optional. This payment opens preselected. It never filters what the widget lists.
// A payment that does not belong to the tax entity fires onError with tax_payments_not_found.
taxPayment: { externalId: 'my_tax_payment_123' },
// Optional, display only. Payments you could not create in Remitian; they never become
// scheduled payments. Once every covered payment is approved, "Done" on the result opens a
// notice listing them.
unsupportedTaxPayments: [
{ taxAuthority: Remitian.TaxAuthority.US_NJ, form: 'Form NJ-1040-ES', taxYear: 2026, dueDate: '2026-09-15', amount: 340.0 },
],
onSuccess: (result) => {}, // { flow: 'PAY_WITH_REMITIAN', taxPayments: [{ externalId?, id, status }] } — approved payments only
onError: (error) => {}, // { flow, code, message, taxPayments?: [{ externalId?, id, status, reason }] }
onExit: (reason) => {}, // never a success signal
onEvent: (event) => {},
}),
);
Building the RemitianConfig by hand also works: the flow-specific parameters (multiplePayments, taxPayment, taxEntity, unsupportedTaxPayments) nest under parameters together with flow: Remitian.Flow.PAY_WITH_REMITIAN, while passwordlessToken, environment and the callbacks stay at the top level.
create validates the configuration and throws a RemitianConfigError with a human-readable message when something is wrong. open/exit after destroy throw a RemitianStateError.
Parameter reference (PAY_WITH_REMITIAN)
The table lists the buildPayWithRemitianConfig inputs.
| Parameter |
Type |
Single payment |
Multiple payments |
Notes |
multiplePayments |
boolean |
No |
Yes (true) |
Defaults to false. New in 1.2.0 |
taxPayment.externalId |
string |
Yes |
No |
Your identifier for the payment. Single: the payment to approve. Multiple: opens preselected |
taxEntity.externalId |
string |
Ignored |
Yes |
Your identifier for the tax entity. In single mode the tax entity comes from the payment |
unsupportedTaxPayments[] |
array |
No |
No |
taxAuthority (Remitian.TaxAuthority), form, taxYear (2020 to the current year + 1), dueDate (yyyy-mm-dd), amount. New on this flow in 1.2.0 |
passwordlessToken |
string |
No |
No |
Non-empty when informed. Without it the widget shows the Remitian login |
environment |
'sandbox' | 'production' |
No |
No |
Defaults to 'production' |
onSuccess / onExit / onError / onEvent |
function |
No |
No |
See Callbacks |
Every externalId must be 3 to 100 characters long and contain only letters, numbers, spaces, underscores, commas, periods or hyphens. Remitian.create rejects any other value. Remitian internal ids are never accepted.
Widget parameters are delivered to the portal in a POST body, never in the URL, so they cannot leak into logs or browser history. The SDK also posts its own version (sdkVersion), which the portal uses to pick the experience.
Pay With Remitian events
| Event |
Fires when |
Payload |
Also calls |
ready |
The widget finished loading |
|
|
step_changed |
Each step transition, including the first step |
{ step }: connections, bank_account, review or result |
|
approved |
Right after a successful approval |
{ flow: 'PAY_WITH_REMITIAN', taxPayments: [{ externalId?, id, status: 'QueuedForPayment' }] }; single payment mode also sends the deprecated taxPayment: { externalId, id, status } |
onSuccess |
error |
Something failed inside the widget |
{ flow: 'PAY_WITH_REMITIAN', code, message, taxPayments? } |
onError |
rejected |
The taxpayer closes the widget with payments pending approval without having attempted an approval |
{ flow: 'PAY_WITH_REMITIAN' } |
|
cancelled |
The taxpayer cancelled a payment that was queued for payment |
{ flow: 'PAY_WITH_REMITIAN', taxPayments: [{ externalId?, id, status: 'Voided' }] } |
|
rescheduled |
The taxpayer rescheduled a payment |
{ flow: 'PAY_WITH_REMITIAN', taxPayments: [{ externalId?, id, status }] } |
|
exit |
The widget closed |
{ reason } |
onExit |
Read taxPayments in onSuccess: it lists only the payments approved in this session, in both modes. The singular taxPayment is deprecated and is removed in 2.0. buildPayWithRemitianConfig types onSuccess with PayWithRemitianMultipleSuccessResult when multiplePayments is true, and with SuccessResult otherwise.
On a partial failure onSuccess receives the approved payments and onError receives the failed ones with a reason.
onError codes:
code |
When |
Extra fields |
approval_failed |
One or more payments could not be approved |
taxPayments[] with reason per payment |
tax_payments_not_found |
A payment the widget cannot show: unknown, paid, cancelled or from another tax entity. In multiple mode also expired or failed with a payment date more than 30 days ago |
taxPayments[] with those externalIds |
tax_entity_not_found |
taxEntity.externalId does not exist in Remitian (multiple mode) |
|
load_failed |
The widget could not load the tax entity, its payments or its accounts |
|
New codes may be added; treat the list as non-exhaustive.
rejected is not an error and does not call onError. After an approval attempt the outcome is reported by approved and error only, and closing the widget fires only exit. onExit is never a success signal.
cancelled calls no callback: read it in onEvent. The taxpayer can cancel a payment only while it is QueuedForPayment, so it can follow approved in the same session. When it does, the payment is Voided and will not be debited.
rescheduled calls no callback either. The taxpayer can reschedule a payment that was queued for payment, one that expired, or one whose debit was returned. status is the status after the reschedule, so do not assume QueuedForPayment. The event carries no dates: read the new dates from the Public API.
status values are the schedule status names exposed as Remitian.TaxPaymentStatus: PendingClientApproval, QueuedForPayment, Submitted, ProcessingSubmission, ProcessingPayment, Processed, PaidManually, Expired, Failed, Voided, Denied, Deleted, Draft, PendingAccountantApproval, PendingRepresentativeApproval, QueuedForReminder, ReminderSent, PaymentLinkClicked. A payment approved in the session comes back as QueuedForPayment.
Upgrading from 1.1.x
1.2.0 is not a breaking release: a 1.1.x integration compiles and runs unchanged. The one exception is TypeScript code that builds a SuccessResult object itself (a test fixture, for example): it must add taxPayments. What changes at run time:
- The widget does not create resources. The payment must exist in Remitian under
taxPayment.externalId before the widget opens. The creation fields below are accepted and ignored.
onSuccess fires with flow and the taxPayments list. Read taxPayments instead of taxPayment.
onSuccess can fire more than once. When the taxpayer approves other payments from the result, taxPayment is not sent: check it or read taxPayments.
step_changed steps are now connections, bank_account, review and result.
Deprecated in 1.2.0 and removed in 2.0: