Skip to main content

Advanced Mode Usage

Overview

Advanced mode provides granular control over mounting, styling, and validation via the AdvancedReverePay class. Use it when you need to:

  • Mount inputs into your own UI using specific element IDs.
  • Listen to per-field validation events and adjust UX.
  • Programmatically update styles, placeholders, and values.
  • Control focus and submission flows.

Initialization

To create an instance of AdvancedReverePay, pass your merchant credentials and a config object. Choose your paymentMethod as 'card' or 'ach'.

import { AdvancedReverePay } from '@revere_payments/tokenizer';
import type { SuccessResponse, ErrorResponse } from '@revere_payments/tokenizer/types';

const reverePay = new AdvancedReverePay({
merchantId: 'yourMerchantId',
publicAPIKey: 'yourPublicAPIKey',
config: {
paymentMethod: 'card',
sandbox: true,
fields: {
// Provide your container IDs; defaults shown below
form: { id: 'ccForm' },
cardHolderName: { id: 'ccHolderName' },
postalCode: { id: 'ccPostalCode' },
cardNumber: { id: 'ccNumber' },
cardExpiration: { id: 'ccExpiration' },
cardCVV: { id: 'ccCvv' }
}
}
});

reverePay.onLoaded = () => console.log('Tokenizer loaded');
reverePay.onSuccess = (data: SuccessResponse) => console.log('SUCCESS', data);
reverePay.onError = (status: number, validation, err?: ErrorResponse) => {
console.log('ERROR', status, validation, err);
};
reverePay.onCheckValidity = (validation) => console.log('VALIDITY', validation);

Constructor Parameters

ParameterTypeRequiredDescription
merchantIdstringYesYour unique merchant identifier.
publicAPIKeystringYesYour public API key.
configConfigYesConfiguration settings for Advanced mode.

Configuration Options

Common options across methods; for full per-method options, see Card and ACH pages.

PropertyTypeRequiredDefaultDescription
paymentMethod'card' | 'ach'YescardSelects the flow to initialize.
sandboxbooleanNofalseEnables sandbox testing.
fieldsCardFieldsConfig | ACHFieldsConfigConditionallyDefaults vary per methodField container IDs, events and styling.
redirectURLURL | stringYes, when paymentMethod is ach-Required Plaid redirect URL for ACH.

Instance Properties

PropertyTypeRequiredDescription
onSuccessFunctionYesFired after a successful submission. Provides response (SuccessResponse).
onErrorFunctionYesFired after a failed attempt. Provides (status, validation, error?: ErrorResponse). See ErrorResponse.
onCheckValidityFunctionNoFired after a validity check runs on the form. Provides validation (Validation) object.
onLoadedFunctionNoFired after the initialization process.

For complete type definitions, see Response Types.