New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

next-stripe-helper

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-stripe-helper - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

19

dist/checkout/index.d.ts
import { Stripe } from 'stripe';
/**
* Options for creating a checkout session in Stripe.
*/
interface CreateCheckoutSessionOptions {
/** The URL to which the user should be redirected after a successful purchase. */
successUrl: string;
/** The URL to which the user should be redirected if they decide to cancel the purchase. */
cancelUrl?: string;
/** Array of line items for the checkout session. */
itemsArray: Stripe.Checkout.SessionCreateParams.LineItem[];
/** The mode of the checkout session, e.g. 'payment' or 'subscription'. Defaults to 'subscription'. */
mode?: Stripe.Checkout.SessionCreateParams.Mode;
/** The ID of the Stripe customer. */
customerId: string;
/** Any additional parameters for the checkout session, if needed. */
additionalParams?: Partial<Stripe.Checkout.SessionCreateParams>;
}
/**
* Create a checkout session in Stripe for making purchases or setting up subscriptions.

@@ -26,3 +9,3 @@ *

*/
declare const createCheckoutSession: (options: CreateCheckoutSessionOptions) => Promise<Stripe.Checkout.Session | undefined>;
declare const createCheckoutSession: (options: Stripe.Checkout.SessionCreateParams) => Promise<Stripe.Checkout.Session | undefined>;
/**

@@ -29,0 +12,0 @@ * Create a checkout session in Stripe specifically for saving a customer's card information.

@@ -14,10 +14,3 @@ "use strict";

try {
const session = await stripe_1.stripe.checkout.sessions.create({
success_url: options.successUrl,
cancel_url: options.cancelUrl,
line_items: options.itemsArray,
mode: options.mode,
customer: options.customerId,
...options.additionalParams
});
const session = await stripe_1.stripe.checkout.sessions.create(options);
return session;

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

2

package.json
{
"name": "next-stripe-helper",
"version": "1.1.7",
"version": "1.1.8",
"description": "Easily add Stripe boilerplate code to Nextjs, like webhook handling, and subscription updates. This package provides a thin wrapper around the Stripe API, and makes integrating Stripe and NextJS a lot faster!",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -5,25 +5,2 @@ import { Stripe } from 'stripe';

/**
* Options for creating a checkout session in Stripe.
*/
interface CreateCheckoutSessionOptions {
/** The URL to which the user should be redirected after a successful purchase. */
successUrl: string;
/** The URL to which the user should be redirected if they decide to cancel the purchase. */
cancelUrl?: string;
/** Array of line items for the checkout session. */
itemsArray: Stripe.Checkout.SessionCreateParams.LineItem[];
/** The mode of the checkout session, e.g. 'payment' or 'subscription'. Defaults to 'subscription'. */
mode?: Stripe.Checkout.SessionCreateParams.Mode;
/** The ID of the Stripe customer. */
customerId: string;
/** Any additional parameters for the checkout session, if needed. */
additionalParams?: Partial<Stripe.Checkout.SessionCreateParams>;
}
/**
* Create a checkout session in Stripe for making purchases or setting up subscriptions.

@@ -35,12 +12,5 @@ *

*/
const createCheckoutSession = async (options: CreateCheckoutSessionOptions): Promise<Stripe.Checkout.Session | undefined> => {
const createCheckoutSession = async (options: Stripe.Checkout.SessionCreateParams): Promise<Stripe.Checkout.Session | undefined> => {
try {
const session = await stripe.checkout.sessions.create({
success_url: options.successUrl,
cancel_url: options.cancelUrl,
line_items: options.itemsArray,
mode: options.mode,
customer: options.customerId,
...options.additionalParams
});
const session = await stripe.checkout.sessions.create(options);
return session;

@@ -47,0 +17,0 @@ } catch (error) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc