Web SDK - RTAF Mode

How to use the ReadyRemit Web SDK in Real Time Account Funding (RTAF) mode

Overview

Real Time Account Funding (RTAF) mode enables direct account-to-card funding through the ReadyRemit Web SDK. When RTAF mode is enabled, the SDK routes the user directly to the fund page, bypassing the standard remittance transfer flow.

RTAF mode is configured by adding the sdkRtaf property to the initialization payload alongside the standard sdkCore and sdkFeatures properties. For general Web SDK setup (iframe, snippet, core options, theming), see the Web SDK Integration Guide.

Initialization

To enable RTAF mode, include the sdkRtaf object in your initialization payload with rtafMode set to true.

SDKRtafOptions

PropertyDescriptionTypeRequired
rtafModeEnable RTAF flow (routes directly to fund page)booleanYes (set to true)
rtafAccountCreatedAccount creation statusbooleanNo
rtafFundingAmountPre-set funding amount in cents (e.g. 10000 = $100.00)numberNo
rtafMinAmountMinimum allowed funding amount in centsnumberNo
rtafMaxAmountMaximum allowed funding amount in centsnumberNo
fundingAccountPre-selected funding source accountSourceAccountNo
⚠️

rtafFundingAmount and rtafMinAmount/rtafMaxAmount are mutually exclusive. Pass either a fixed rtafFundingAmount or a rtafMinAmount/rtafMaxAmount range, but not both.

Account Passing: RTAF vs. Remittance

In Remittance mode, accounts are passed via virtualSenderAccounts. See the Web SDK Integration Guide for details.

In RTAF mode, the account is passed as a single pre-selected fundingAccount object inside sdkRtaf. The SDK uses this account directly for the funding flow — no dropdown selection is presented.

fundingAccount (SourceAccount)

PropertyDescriptionTypeRequired
aliasA user-friendly name for the account (e.g., "Main Checking")stringNo
last4Last four digits of the account numberstringNo
balanceNot used in RTAF modenumberNo
srcProviderIdYour internal reference for the accountstringYes

Code Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="https://sandbox-sdk.readyremit.com/scripts/snippet.min.js"></script>
    <title>ReadyRemit RTAF Example</title>
  </head>
  <body>
    <iframe 
      id="readyremit-iframe" 
      src="https://sandbox-sdk.readyremit.com"
      allow="clipboard-read; clipboard-write; camera"    
      width="100%" 
      height="100%" 
      style="display: none;"
      title="Account Funding"
    ></iframe>
    <script>
      const customerId = "{'<this will be provided by ReadyRemit>'}";
      const resources = "{'<encrypted resources, this should be generated in the customer backend>'}";
      window.rremit.init(
        {
          sdkCore: {
            customerId,
            resources,
            language: "en-US",
          },
          sdkFeatures: {
            darkMode: false,
          },
          sdkRtaf: {
            rtafMode: true,
            rtafFundingAmount: 50000,
            rtafMinAmount: 1000,
            rtafMaxAmount: 100000,
            fundingAccount: {
              alias: "Main Checking",
              last4: "1234",
              balance: 100000,
              srcProviderId: "your-internal-account-id"
            }
          }
        },
        async (eventPayload) => {
          try {
            // RTAF eventPayload.transfer shape:
            // {
            //   quoteBy: "SEND_AMOUNT",
            //   amount: number,          // Amount in cents
            //   sourceAccountId: string,  // AFT source account id
            //   quoteId: string,          // Quote history id
            //   nonce: string,            // Idempotency nonce
            // }
            //
            // Post to your backend → call POST /account-funding-transfers
            // Example:
            // let fundingResponse = postFundingToServer(eventPayload.transfer, resources);
            // let transferId = fundingResponse.transferId;

            window.rremit.completed(transferId);
          } catch (error) {
              window.rremit.failed(error);
          }
        }
      );

      // Listen for the funding-completed message when user clicks "Continue"
      // on the Confirmation or Pending page
      window.addEventListener("message", function (event) {
        if (event.data?.type === "readyremit-funding-completed") {
          const { transferId } = event.data.payload || {};
          // Persist the result, update your UI, or close the iframe
        }
      });
    </script>
  </body>
</html>

RTAF vs. Remittance eventPayload

The eventPayload received by the onCreateCallback has a different transfer shape in RTAF mode compared to standard Remittance mode. For the standard Remittance eventPayload structure, see the Web SDK Integration Guide.

RTAF eventPayload

{
  language: string;      // e.g. "en-US"
  transfer: {
    quoteBy: "SEND_AMOUNT";       // Fixed value for RTAF
    amount: number;                // Amount in cents (e.g. 10000 = $100.00)
    sourceAccountId: string;       // AFT source account id
    quoteId: string;               // Quote history id from SDK quote step
    nonce: string;                 // Server-side nonce for idempotency
  };
  clientVersion: string;
}
  • Host calls POST /account-funding-transfers (not /transfers)
  • No recipientId or recipientAccountId
  • Uses quoteId (not quoteHistoryId), amount, sourceAccountId, and nonce
📘

Detecting RTAF payload

Presence of quoteId, amount, and sourceAccountId, and absence of recipientId, indicates an RTAF (account-funding) request rather than a standard transfer.

RTAF Response Handling

After receiving the eventPayload and calling your backend, notify the SDK with one of three responses:

ResponseMethodDescription
Successrremit.completed(transferId)Transfer created successfully. The SDK shows the Confirmation page.
Failurerremit.failed(error)Transfer creation failed. The SDK displays the error to the user.
Pendingrremit.pending(transferId)Transfer authorized but not yet completed. The SDK shows the Pending page.

The pending response is specific to RTAF and is used when the funding has been authorized but final settlement is not yet confirmed.

Funding Completed Message

When the user clicks Continue on the RTAF Confirmation or Pending page, the SDK sends a readyremit-funding-completed message to the host. This message contains the transfer result payload so the host can persist it or close the iframe.

⚠️

Important

The ReadyRemit snippet does not automatically invoke a callback for readyremit-funding-completed. You must subscribe to the message event and handle it directly, as shown in the code example above.

Payload:

{
  transferId: string;
  // Any additional fields your backend returned when posting
  // transfer-completed are echoed here.
}

Message Reference

TypeDirectionDescription
readyremit-create-transferSDK → HostUser submitted the fund form. For RTAF, payload.transfer is the /account-funding-transfers body.
readyremit-transfer-completedHost → SDKTransfer created successfully. Include payload.transferId.
readyremit-transfer-failedHost → SDKTransfer creation failed. Include payload.error.
readyremit-transfer-pendingHost → SDKRTAF authorized but not yet completed. Include payload.transferId.
readyremit-funding-completedSDK → HostUser clicked Continue on RTAF Confirmation/Pending page. Payload contains the transfer result.