Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

o10r-pp-flow

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

o10r-pp-flow

`o10r-pp-flow` is a TypeScript library for building payment pages. It provides a single flow object with the methods, data and events required to initialize the payment context, handle user input and finalize the transaction.

latest
Source
npmnpm
Version
0.4.5
Version published
Maintainers
1
Created
Source

o10r-pp-flow

o10r-pp-flow is a TypeScript library for building payment pages. It provides a single flow object with the methods, data and events required to initialize the payment context, handle user input and finalize the transaction.

📦 Installation

npm install o10r-pp-flow

Requires Node.js v24+

🚀 Usage

Create a flow

import PPFlow from 'o10r-pp-flow';
import paymentMethodFactory from '...';

const apiHost = 'https://example.com';
const flow = PPFlow(apiHost, paymentMethodFactory);

Subscribe to events

flow.on('init', (ctx) => console.log('Initialized', ctx));
flow.on('statusChanged', (ctx) => console.log('Status', ctx.paymentStatus.status));
flow.on('paymentMethodsChanged', () => console.log('Methods', flow.paymentMethods));
flow.on('languageChanged', (lang) => console.log('Language', lang));

Initialize the flow

const jwtToken = '...';
await flow.init(jwtToken);

init loads project settings, payment methods and payment status. You may also call flow.init(jwtToken) without awaiting and react to the init event.

Access the context

console.log(flow.context.amount);
console.log(flow.context.currency);

The context object is populated after init and is emitted with every event handler.

Work with payment methods

const method = flow.paymentMethods[0];

// Remove a saved payment method
await flow.remove(method);

Listen to paymentMethodsChanged to track updates to the paymentMethods array.

Change language

import { Language } from 'o10r-pp-core';

await flow.translator.setLanguage(Language.FR);
console.log(flow.translator.t('PAY'));

Pay

const method = flow.paymentMethods[0];
// Collect payment data using method's own API if needed
await flow.pay(method);

After pay, the latest payment status is requested automatically and emitted via statusChanged.

Clarify additional data

import { PaymentStatus } from 'o10r-pp-core';

if (flow.context.paymentStatus.status === PaymentStatus.AWAITING_CLARIFICATION) {
  await flow.clarify({ code: '123456' });
}

See the exported Flow, Context, EventMap and payment method types for complete type information.

FAQs

Package last updated on 25 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts