kohortpay-checkout v0.4.0
kohortpay-checkout
SDK Installation
NPM
npm add kohortpay-checkout
Yarn
yarn add kohortpay-checkout
SDK Example Usage
import { Kohortpay } from "kohortpay-checkout";
import { CheckoutSessionsControllerCreateSecurity } from "kohortpay-checkout/dist/sdk/models/operations";
(async () => {
const sdk = new Kohortpay();
const operationSecurity: CheckoutSessionsControllerCreateSecurity = {
basic: {
password: "",
username: "",
},
};
const res = await sdk.checkoutSessionsAPI.checkoutSessionsControllerCreate(
{
cancelUrl: "https://cancel.example.com",
customerEmail: "customer@example.com",
customerFirstName: "John",
customerId: "user_xxxxxxxxxxxxxxxx",
customerLastName: "Doe",
expiresAt: new Date("2023-10-02T14:30:00.000Z"),
lineItems: [
{
description: "Item Description",
imageUrl: "https://example.com/image.jpg",
name: "Item Name",
price: 100,
quantity: 1,
},
],
metadata: {},
successUrl: "https://success.example.com",
},
operationSecurity
);
if (res.statusCode == 200) {
// handle response
}
})();
Available Resources and Operations
checkoutSessionsAPI
- checkoutSessionsControllerCreate - Create a new checkout session.
- checkoutSessionsControllerExpire - Expire a checkout session by ID for the current organization and livemode.
- checkoutSessionsControllerFindAll - Retrieve all checkout sessions for the current organization and livemode.
- checkoutSessionsControllerFindOne - Retrieve a checkout session by ID for the current organization and livemode.
organizations
- organizationsControllerFindCheckoutSettings - Retrieve checkout settings for a specified organization ID.
- organizationsControllerFindOne - Retrieve an organization by ID or Clerk ID.
- organizationsControllerFindPaymentGroupSettings
- organizationsControllerUpdate - Update the details of a specified organization.
- organizationsControllerUpdateCheckoutSettings - Update checkout settings for a specified organization ID.
- organizationsControllerUpdatePaymentGroupSettings - Update an organization by ID.
paymentGroups
- paymentGroupsControllerCancel - Cancel a payment group by id
- paymentGroupsControllerCreate - Create a new payment group
- paymentGroupsControllerExpire - Expire a payment group by id
- paymentGroupsControllerFindAll - Retrieve all payment groups
- paymentGroupsControllerFindOne - Retrieve a payment group by id
- paymentGroupsControllerParticipants - Retrieve participants of a payment group by id
- paymentGroupsControllerUpdate - Update a payment group by id
- paymentGroupsControllerValidate - Validate a payment group by id
paymentGroupSettingsAPI
- paymentGroupSettingsControllerFindOne - Retrieve payment group settings by ID.
- paymentGroupSettingsControllerUpdate - Update payment group settings by ID.
paymentIntents
- paymentIntentsControllerCancel - Cancel a Payment Intent by ID
- paymentIntentsControllerCreate - Create a new Payment Intent
- paymentIntentsControllerFindAll - Retrieve all Payment Intents
- paymentIntentsControllerFindOne - Retrieve a Payment Intent by ID
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a next
method that can be called to pull down the next group of results. If the
return value of next
is null
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
Development
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!