Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Overview

Reference

The PaymentKit Node.js SDK provides a straightforward and efficient interface for integrating your Node.js application with the PaymentKit API. It is designed to simplify the management of customers, subscriptions, products, payments, and sophisticated credit-based billing systems, allowing you to focus on your core application logic.

The SDK is available as an NPM package and is fully typed with TypeScript, offering a superior development experience with autocompletion and compile-time error checking.

How It Works#

The SDK acts as a convenient wrapper around the PaymentKit REST API. Your application initializes the SDK client, which then handles the authentication and communication required to interact with various API resources.

PaymentKit API Resources

PaymentKit SDK

Your Application

Initialize & Call Methods

Makes Secure API Requests

Makes Secure API Requests

Makes Secure API Requests

Makes Secure API Requests

Sends Event Notifications

Node.js Backend

@blocklet/payment-js

Checkout

Subscriptions

Products & Prices

Credit-Based Billing

Webhooks


Core Functionalities#

Comprehensive Resource Management

Easily perform CRUD (Create, Read, Update, Delete) operations on essential resources:

  • Customers: Manage your user base.
  • Products & Prices: Define what you sell and how you price it.
  • Subscriptions: Handle recurring billing and subscription lifecycles.
  • Payments: Create and manage payment intents.

Flexible Checkout Flow

Create secure and customizable checkout sessions for both one-time payments and subscriptions. Redirect customers to a PaymentKit-hosted page to complete their purchases, and then guide them back to your application using success_url and cancel_url.

Advanced Credit-Based Billing

Implement usage-based billing models with a powerful credit system:

  • Meters: Track the consumption of any resource, such as API calls, data storage, or compute time. You can define aggregation methods like sum, count, or last.
  • Credit Grants: Issue credits to customers. Credits can be purchased (paid) or given away for free (promotional).
  • Meter Events: Report usage events from your application. The system automatically deducts the corresponding amount from the customer's credit balance.
  • Balance & Transactions: Programmatically check a customer's credit balance and view their transaction history.

Real-time Notifications with Webhooks

Configure webhook endpoints to receive real-time notifications about events happening in your PaymentKit account. This allows your application to react automatically to events like:

  • checkout.session.completed
  • customer.subscription.created
  • payment_intent.succeeded


Now that you have an overview of the SDK's capabilities, you are ready to set up your environment and begin implementation.

Next, head to the Get Started guide to install the SDK and make your first API call.