notrix
v1.3.5
Published
Notrix Official JavaScript SDK
Downloads
30
Maintainers
Readme
Notrix JavaScript SDK
Install
npm install notrix
Examples
Create Checkout Session
import Client from "notrix";
let client = new Client("SECRET_API_KEY", "PROJECT_ID");
let checkoutSession = await client.createCheckoutSession(
[
{
name: "Bike",
description: "green",
price: 32.56, // USD
quantity: 1,
imageURL: "https://example.com/bike.png" // make sure the image is available from the notrix.io domain
}
],
"https://example.com/success",
"https://example.com/cancel",
);
console.log(checkoutSession.url); // redirect the user here to pay
Check Payment Status
import Client from "notrix";
let client = new Client("SECRET_API_KEY", "PROJECT_ID");
let paymentConfirmed = await client.isPaid(checkoutSession.paymentRequestToken); // true / false