UNPKG

lumepay-sdk

Version:

SDK for Payment Gateway - Easily verify bank transfer payments

39 lines (27 loc) 1.51 kB
LumePay SDK A JavaScript SDK for interacting with the LumePay payment gateway API. Installation npm install lumepay-sdk Usage To use the LumePay SDK, you need to create an instance of the PaymentGateway class. Here's an example: const PaymentGateway = require('lumepay-sdk'); const gateway = new PaymentGateway({ apiKey: 'your-api-key', baseUrl: 'https://api.lumepay.com' }); You can then use the gateway object to create a payment intent, retrieve a payment intent by ID, or submit a payment. Creating a Payment Intent const intent = await gateway.createIntent({ amount: 1000, customerEmail: 'customer@example.com', metadata: { /* optional metadata */ } }); Retrieving a Payment Intent const retrievedIntent = await gateway.getIntent(intent.id); Submitting a Payment const paymentResponse = await gateway.submitPayment({ intentId: intent.id, transactionId: 'your-transaction-id' }); Features The LumePay SDK provides the following features: Creates payment intents Retrieves payment intents by ID Submits payments Handles errors using a custom PaymentGatewayError class API Documentation The PaymentGateway class takes an options object with apiKey and baseUrl properties. It provides methods for creating, retrieving, and submitting payments. Methods createIntent({ amount, customerEmail, metadata }): Creates a new payment intent. getIntent(intentId): Retrieves a payment intent by ID. submitPayment({ intentId, transactionId }): Submits a payment. License MIT