Quick Start
The @blocklet/payment-js
package is a powerful Node.js SDK for interacting with the PaymentKit API. It provides developers with tools to seamlessly manage customers, subscriptions, products, prices, payments, checkout sessions, usage records, and webhooks. This documentation outlines how to get started quickly and highlights the key capabilities of the SDK.
seamlessly manage customers, subscriptions, products, prices, payments, checkout sessions, usage records, and webhooks
For more details, visit the npm package page.
Quick Start#
Getting up and running @blocklet/payment-js
is simple. Follow these steps:
- Install the SDK
Install the package via npm:
npm install @blocklet/payment-js
- Configure the SDK
Import the SDK and set your environment (test or live mode):
import payment from '@blocklet/payment-js';
// Set to test mode (use true for testing, false or omit for live)
payment.environments.setTestMode(true);
// Alternatively, use environment variables
// PAYMENT_TEST_MODE=true node your-script.js
- Try a Basic Operation
List subscriptions as a quick test:
const subscriptions = await payment.subscriptions.list({
order: 'updated_at:ASC', // Sort by update time
activeFirst: true, // Prioritize active subscriptions
});
console.log(subscriptions);
That’s it! You’re ready to explore the full capabilities of the SDK.