@payfrontline/pay
v0.1.1
Published
Frontline payments SDK (stub implementation).
Downloads
9
Readme
@payfrontline/pay
Frontline Payments SDK for creating, managing, and settling payments with a type-safe, developer-friendly API.
Install
npm install @payfrontline/payUsage
import { Frontline } from "@payfrontline/pay";
Frontline.configure({
merchantId: "merchant_789",
environment: "sandbox"
});
const payment = await Frontline.checkout({
amount: 1200,
userId: "user_123",
mode: "BNPL",
currency: "USD",
referenceId: "order_456",
metadata: {
cartId: "cart_999"
}
});
await payment.authorize();
await payment.settle();API overview
Initialize
import { Frontline, FrontlineClient } from "@payfrontline/pay";
Frontline.configure({
merchantId: "merchant_789",
environment: "production"
});
const client = new FrontlineClient({
merchantId: "merchant_789"
});Payments
const payment = await Frontline.checkout({
amount: 1200,
userId: "user_123",
mode: "CARD",
captureMethod: "manual"
});
await payment.authorize();
await payment.settle();Refunds
const refund = await payment.refund({
amount: 500,
reason: "partial_return"
});Retrieve and list
const samePayment = await Frontline.getPayment(payment.id);
const results = await Frontline.listPayments({
merchantId: "merchant_789",
status: "settled"
});