0.3.0 • Published 6 months ago
@crayond_dev/pasm-sdk v0.3.0
PasmClient
Description
PasmClient is an npm package that provides a client SDK for working with the PASM (Plan and Subscription Management) service. It allows you to interact with the service and check the validity of subscriptions based on provided customer information.
Installation
To install PasmClient, you can use npm or yarn:
npm install @crayond_dev/pasm-sdk
# or
yarn add @crayond_dev/pasm-sdk
Usage
Importing PasmClient
import PasmClient from "@crayond_dev/pasm-sdk";
Creating an Instance
To create an instance of PasmClient,
const params = {
customer_id: "<YOUR_CUSTOMER_ID_HERE>", // Replace with your customer_id
};
const pasmClient = new PasmClient(params);
Checking Subscription Validity
The PasmClient class exposes a method called isValidSubscription, which allows you to check the validity of the subscription for the provided customer.
pasmClient.isValidSubscription()
.then((isValid) => {
console.log(`Is the subscription valid? ${isValid}`);
})
.catch((error) => {
console.error("Error while checking subscription validity:", error);
});