This page is part of the Payments Library Guides . Prefer direct API calls instead? See REST API Guides .
Engine Constructor
import * as eWallet from 'orchestrasolutions-ewallet' ;
const engine = new eWallet . Engine (
sessionToken , // Required: from POST /EWalletOperations
requiredAncillaryInfo , // Optional: address collection requirements
language // Optional: UI language code
);
Parameter Type Description sessionTokenstringSession token from your backend via POST /EWalletOperations requiredAncillaryInfoRequiredAncillaryInfo | undefinedBilling/shipping address requirements languagestring | undefinedLanguage code for UI (see Localization )
checkAvailability()
Returns the list of payment methods available on the current device and browser:
const available = await engine . checkAvailability ();
// Returns: ["CardPay", "GooglePay", "PayPal", ...]
Use this to filter which buttons to display. For example, Apple Pay is only available on Safari/iOS, and Google Pay only on Chrome/Android.
payBy() Method
engine . payBy (
eWalletList , // Required: buttons to display
callback , // Required: called when payment completes
buttonProperties , // Optional: button styling
requiredAncillaryInfo // Optional: override address requirements
);
Each button is an object with name and domEntitySelector:
{ name : 'CardPay' , domEntitySelector : '#card-button' }
Customize button appearance with ButtonProperties:
const buttonProperties = {
color: 'Dark' , // "Light" or "Dark"
text: 'Pay' , // "None", "Pay", "Buy", "Subscribe", "Book", "Checkout", "Donate"
width: '200px' ,
height: '40px' ,
logoPath: '/path/to/logo.png' // Optional
};
engine . payBy ( buttons , handleResult , buttonProperties );
Parsing Results
Use parseResultToken() to decode the result token into structured data:
function handleResult ( result ) {
if ( ! result ) return ;
const [ data , success ] = engine . parseResultToken ( result . token );
The method returns a tuple:
data - The parsed result object containing payment details
success - Boolean indicating if the token was successfully decoded (not whether the payment succeeded)
To determine if a payment succeeded, check data.clientSuccess:
if ( ! data . clientSuccess ) {
console . error ( 'Payment failed:' , data . clientErrorMessage );
return ;
}
// Check which type of result we received
if ( data . upgChargeResults ) {
// Payment processed through a PSP (CardPay, ApplePay, GooglePay)
console . log ( 'Gateway:' , data . upgChargeResults . gatewayName );
console . log ( 'Reference:' , data . upgChargeResults . gatewayReference );
console . log ( 'Amount:' , data . upgChargeResults . amount , data . upgChargeResults . currency );
}
if ( data . directChargeResults ) {
// Payment processed directly (PayPal, BankPay, UPI)
console . log ( 'Success:' , data . directChargeResults . success );
console . log ( 'Message:' , data . directChargeResults . message );
}
if ( data . tokenAndMaskedCardModel ) {
// Tokenization result
console . log ( 'Token:' , data . tokenAndMaskedCardModel . token );
console . log ( 'Card:' , data . tokenAndMaskedCardModel . bankCard . type );
console . log ( 'Last 4:' , data . tokenAndMaskedCardModel . bankCard . number );
if ( data . tokenAndMaskedCardModel . threeDs ) {
console . log ( '3DS ECI:' , data . tokenAndMaskedCardModel . threeDs . eci );
}
}
}
Result Data Structure
EWalletResultData {
clientSuccess : boolean ;
clientErrorMessage : any ;
// For PSP charges (CardPay, ApplePay, GooglePay)
upgChargeResults ?: {
gatewayName: string ;
gatewayReference : string ;
authorizationCode : string ;
amount : number ;
currency : string ;
operationType : string ; // "Charge", "PreAuth", etc.
operationResultCode : string ; // "Success", "Rejected", etc.
operationResultDescription : string ; // Human-readable result message
gatewayResultDescription : string ; // Message from the payment gateway
};
// For direct charges (PayPal, BankPay, UPI)
directChargeResults ?: {
success: boolean ;
message : string ;
data : object ;
};
// For tokenization
tokenAndMaskedCardModel ?: {
token: string ;
bankCard : {
type: string ; // "Visa", "Mastercard", etc.
number : string ; // Masked: "************1234"
expirationMonth : number ;
expirationYear : number ;
nameOnCard : string ;
};
threeDs ?: {
eci: string ;
authenticationValue : string ;
xid : string ;
version : string ;
};
};
}
Address Collection
Request billing and/or shipping addresses from the payment method (supported by Google Pay, Apple Pay, PayPal).
Configuration
const requiredAncillaryInfo = {
billingInfo: {
phoneRequired: true ,
emailAddressRequired: true ,
details: 'FULL' // "MIN" or "FULL"
},
shippingInfo: {
phoneRequired: false ,
emailAddressRequired: false
}
};
const engine = new eWallet . Engine ( sessionToken , requiredAncillaryInfo );
Address Levels
Level Fields Included "MIN"name, countryCode, postalCode, phone (if required), email (if required) "FULL"MIN fields + addressLines, locality (city), administrativeArea (state/province)
Retrieving Addresses
After payment completes, retrieve the collected addresses:
function handleResult ( result ) {
if ( ! result ) return ;
const billing = engine . getBillingInfo ();
if ( billing ) {
console . log ( 'Name:' , billing . name );
console . log ( 'Email:' , billing . emailAddress );
console . log ( 'Country:' , billing . countryCode );
console . log ( 'Postal:' , billing . postalCode );
// FULL address fields (if requested)
if ( billing . addressLines ) {
console . log ( 'Street:' , billing . addressLines . join ( ', ' ));
console . log ( 'City:' , billing . locality );
console . log ( 'State:' , billing . administrativeArea );
}
}
const shipping = engine . getShippingInfo ();
if ( shipping ) {
console . log ( 'Ship to:' , shipping . name );
console . log ( 'Address:' , shipping . addressLines ?. join ( ', ' ));
}
}
Additional Methods
getSessionType()
Returns the operation type for this session:
const sessionType = engine . getSessionType ();
// "CHARGE", "TOKENIZE", "CHARGE_AND_TOKENIZE", or "PREAUTH_AND_TOKENIZE"
getSelectedProviderName()
Returns which payment method the customer used:
function handleResult ( result ) {
const provider = engine . getSelectedProviderName ();
console . log ( 'Customer paid with:' , provider );
// "CardPay", "GooglePay", "ApplePay", "PayPal", "BankPay", or "UPI"
}
Localization
The library supports 20 languages. Pass a language code to the constructor:
const engine = new eWallet . Engine ( sessionToken , undefined , 'de' );
Supported Languages
Code Language Code Language enEnglish nlDutch deGerman plPolish esSpanish ptPortuguese frFrench ruRussian itItalian svSwedish heHebrew trTurkish csCzech zhChinese elGreek koKorean fiFinnish skSlovak noNorwegian srSerbian
Operations
The session operation (set when creating the session) determines what the library does:
Operation Description CHARGEProcess payment immediately TOKENIZEStore payment method, return token for later charges CHARGE_AND_TOKENIZEProcess payment and return a token PREAUTH_AND_TOKENIZEAuthorize payment and return a token for later capture
Tokenization is only available for CardPay, ApplePay, and GooglePay. PayPal, BankPay, and UPI support charge only.
Payment Method Requirements
CardPay, ApplePay, GooglePay
Requires a payment processor (PSP) configured in your Orchestra account. Pass paymentGatewayAccountId when creating the session.
Orchestra supports payment gateways .
ApplePay, GooglePay
In addition to PSP credentials, these require:
Merchant registration with Apple/Google
Domain verification
A PSP that supports 3DS
See ApplePay Setup and GooglePay Setup for details.
PayPal
Requires PayPal merchant credentials configured in the Orchestra Portal . See PayPal Setup for details.
BankPay
Requires an Open Banking or ACH provider account configured in the Orchestra Portal . Contact our team to confirm regional support.
UPI
Requires a UPI provider account configured in the Orchestra Portal . Only available for INR transactions in India.
Library Setup Quick start guide
Supported Payment Methods All payment methods
Result Handling Parse payment results
Payments Library API Backend endpoint reference