This page is part of the Payments Library Guides. Prefer direct API calls instead? See REST API Guides.
Prerequisites: API key, Payment Gateway Account, and eWallet Account configured.
The Orchestra Payments Library displays payment buttons and handles the payment UI. It supports card entry, Apple Pay, Google Pay, PayPal, bank payments, and UPI.
Installation
npm install bluetime-ewallet
CDN Usage
When loading via CDN, the library attaches to window.eWallet:
const engine = new eWallet.Engine(sessionToken);
Data Flow
Your server creates a session with Orchestra and passes the JWT to the client. The client initializes the library, displays payment buttons, and handles customer interaction. After payment, the result JWT is returned to the client, which passes it to your server for validation with Orchestra.
Quick Start
1. Initialize the Engine
import * as eWallet from 'bluetime-ewallet';
const engine = new eWallet.Engine(sessionToken);
The sessionToken comes from your backend via POST /EWalletOperations.
2. Check Available Payment Methods
const available = await engine.checkAvailability();
// Returns: ["CardPay", "GooglePay", "PayPal", ...]
Add container elements to your HTML:
<div id="card-button"></div>
<div id="gpay-button"></div>
<div id="paypal-button"></div>
Each payment method requires its own container element with a unique selector. If you add multiple payment methods, create a separate container for each.
Render buttons for available methods:
const buttons = [
{ name: 'CardPay', domEntitySelector: '#card-button' },
{ name: 'GooglePay', domEntitySelector: '#gpay-button' },
{ name: 'PayPal', domEntitySelector: '#paypal-button' }
].filter(btn => available.includes(btn.name));
engine.payBy(buttons, handleResult, undefined);
4. Handle Results
function handleResult(result) {
if (!result) {
console.log('Payment cancelled');
return;
}
// Send token to your backend for validation
fetch('/api/validate-payment', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token: result.token })
});
}
Your backend should validate the result token using POST /EWalletOperations/validateResults before fulfilling orders.
Payment Methods
| Value | Description | Availability |
|---|
"CardPay" | Credit/debit card form | All browsers |
"GooglePay" | Google Pay | Chrome, Android |
"ApplePay" | Apple Pay | Safari, iOS, macOS |
"PayPal" | PayPal checkout | All browsers |
"BankPay" | Bank transfer (Open Banking, ACH) | All browsers |
"UPI" | Unified Payments Interface | All browsers |
What’s Next