Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

stripe create subscription

/*
	1) Create a stripe customer
    2) Create a product
    3) Create payment session
*/

// Create payment session
const amount = 100 // 100 usd

const session = await stripe.core.checkout.sessions.create({
   customer: customerId,
   payment_method_types: ['card'],
   line_items: [
     {
       price_data: {
         currency: 'usd',
         product: productId,
         unit_amount: amount * 100,
         recurring: {
           interval: 'month' // 'month' | 'year'
         }
       },
       quantity: 1
     }
   ],
   mode: 'subscription',
   success_url: successUrl,
   cancel_url: cancelUrl
 })
Comment

create stripe subscription pay_immediately

const stripe = require('stripe')(STRIPE_KEY);

const subscription = await stripe.subscriptions.create({
  customer: CUSTOMER_ID,
  items: [
    {price: PRICE_ID},
  ],
  pay_immediately: false
});
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# method declaration 
Csharp :: C# Console font 
Csharp :: elasticsearch nested aggregation in c# 
Csharp :: HttpClient .net Core add Certificate 
Csharp :: insert data to access database c# 
Csharp :: by value by reference c# 
Csharp :: ascii code c# char 
Csharp :: dbset 
Csharp :: convert xml to json 
Csharp :: create dropdown in datatable c# dynamically 
Csharp :: unity action 
Csharp :: .net using appsettings variables 
Csharp :: combined 2 arrays 
Csharp :: while loop in c# 
Csharp :: Storing Data within your TileEntity 
Csharp :: .net core web api save pdf file in local folder 
Csharp :: mongodb custom IIdGenerator 
Csharp :: c# core linq savechanges invalid column name error while adding but not while updating 
Csharp :: c# odp.net close session 
Csharp :: Code snipet for jump script unity 2d 
Csharp :: c# ilogger for inherited class 
Csharp :: join where order by .net framework 
Csharp :: how to increase alpha in strings using unity 
Csharp :: parse error message: could not create type webservice.webservice asp .net 
Csharp :: Razor break/continue in loop 
Csharp :: Alll select options unselectable 
Csharp :: nodatime instant to datetime off set c# 
Csharp :: how long dose it take for formate a currupt USB? 
Csharp :: c# is file closed 
Csharp :: il c# 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =