🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

chargebee-init

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chargebee-init - npm Package Compare versions

Comparing version
1.0.0-beta.1
to
1.0.0-beta.2
+54
README.md
# chargebee-init
`chargebee-init` is a CLI to help integrate Chargebee services with your existing app. It supports popular Node.js frameworks and libraries and takes an opinionated approach to setting up _just_ enough boilerplate so you can focus on how your business domain uses Chargebee services.
The following Chargebee features are currently supported:
* Checkout one time charges
* Checkout subscription plan
* Manage payment methods
* Customer portal
* Handle incoming webhook events
**Note: The CLI does not provide additional UI components. It uses the Chargebee Node SDK to invoke the relevant APIs from your backend service**
## Framework support
The CLI integrates the following backend-frameworks
| Framework | Version | Notes |
|-----------|---------|-------|
| Next.js | 15 | Only App Router supported |
| Express | 5 | |
## Requirements
* Node.js >= 20
* Existing app should be TypeScript based
## Quick start
Run `npx chargebee-init` in your existing app directory.
## Installation
The CLI can be invoked directly via `npx` or an equivalent script runner:
```
# Node.js
npx chargebee-init
# Bun
bunx chargebee-init
```
It can also be installed globally as a NPM package:
```
npm install -g chargebee-init
```
+2
-2

@@ -7,3 +7,3 @@ import path from "node:path";

minVersion: "15",
dependencies: ["@chargebee/nextjs:~0.1.0"],
dependencies: ["@chargebee/nextjs:^1.0.0"],
appDirectories: ["app", path.join("src", "app")],

@@ -14,3 +14,3 @@ },

minVersion: ">=5",
dependencies: ["@chargebee/express:~0.1.0"],
dependencies: ["@chargebee/express:^1.0.0"],
appDirectories: ["app", "src"],

@@ -17,0 +17,0 @@ },

@@ -11,2 +11,3 @@ import {

type PortalCreateInput,
raiseWarning,
type SubscriptionInput,

@@ -30,5 +31,3 @@ validateBasicAuth,

apiPayload: async (req: Request) => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// https://api-explorer.chargebee.com/item_prices/list_item_prices

@@ -60,5 +59,3 @@ const { list } = await chargebee.itemPrice.list({

apiPayload: async (req: Request) => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// https://api-explorer.chargebee.com/item_prices/list_item_prices

@@ -89,5 +86,3 @@ const { list } = await chargebee.itemPrice.list({

apiPayload: async (req: Request) => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// https://apidocs.chargebee.com/docs/api/hosted_pages?lang=node#manage_payment_sources

@@ -111,5 +106,3 @@ return {

apiPayload: async (req: Request) => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// TODO: Return the authenticated customer here

@@ -129,5 +122,3 @@ return {

async function callbackController(req: Request, _res: Response) {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
const { searchParams } = new URL(req.originalUrl);

@@ -146,5 +137,3 @@ const id = searchParams.get("id");

async function webhookController(req: Request, _res: Response) {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// HTTP Basic Auth is currently optional when adding a new webhook

@@ -151,0 +140,0 @@ // url in the Chargebee dashboard. However, we expect it's set by default.

@@ -1,8 +0,6 @@

import { client } from "@chargebee/nextjs";
import { client, raiseWarning } from "@chargebee/nextjs";
import type { NextRequest } from "next/server.js";
export const GET = async (req: NextRequest) => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
const id = req.nextUrl.searchParams.get("id");

@@ -9,0 +7,0 @@ const state = req.nextUrl.searchParams.get("state");

@@ -1,2 +0,6 @@

import { type ManageInput, managePaymentSources } from "@chargebee/nextjs";
import {
type ManageInput,
managePaymentSources,
raiseWarning,
} from "@chargebee/nextjs";
import type { NextRequest } from "next/server.js";

@@ -8,5 +12,3 @@

apiPayload: (req: NextRequest): ManageInput => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// https://apidocs.chargebee.com/docs/api/hosted_pages?lang=node#manage_payment_sources

@@ -13,0 +15,0 @@ return {

@@ -5,2 +5,3 @@ import {

createOneTimeCheckout,
raiseWarning,
} from "@chargebee/nextjs";

@@ -13,5 +14,3 @@ import type { NextRequest } from "next/server.js";

apiPayload: async (req: NextRequest): Promise<ChargeInput> => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
const chargebee = await client.getFromEnv();

@@ -18,0 +17,0 @@ // https://api-explorer.chargebee.com/item_prices/list_item_prices

import {
client,
createSubscriptionCheckout,
raiseWarning,
type SubscriptionInput,

@@ -12,5 +13,3 @@ } from "@chargebee/nextjs";

apiPayload: async (req: NextRequest): Promise<SubscriptionInput> => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
const chargebee = await client.getFromEnv();

@@ -17,0 +16,0 @@ // https://api-explorer.chargebee.com/item_prices/list_item_prices

@@ -1,2 +0,6 @@

import { createPortalSession, type PortalCreateInput } from "@chargebee/nextjs";
import {
createPortalSession,
type PortalCreateInput,
raiseWarning,
} from "@chargebee/nextjs";
import type { NextRequest } from "next/server.js";

@@ -8,5 +12,3 @@

apiPayload: async (req: NextRequest): Promise<PortalCreateInput> => {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// TODO: Return the authenticated customer here

@@ -13,0 +15,0 @@ return {

@@ -1,8 +0,10 @@

import { type Chargebee, validateBasicAuth } from "@chargebee/nextjs";
import {
type Chargebee,
raiseWarning,
validateBasicAuth,
} from "@chargebee/nextjs";
import { type NextRequest, NextResponse } from "next/server.js";
export async function POST(req: NextRequest) {
console.warn(
`⚠ This is the default implementation from chargebee-init and must be reviewed!`,
);
raiseWarning();
// HTTP Basic Auth is currently optional when adding a new webhook

@@ -9,0 +11,0 @@ // url in the Chargebee dashboard. However, we expect it's set by default.

{
"name": "chargebee-init",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"author": {

@@ -5,0 +5,0 @@ "name": "Chargebee",