Question : stripe create customer
Answered by : florin-relea
/* Create customer account
*/
const customer = await stripe.customers.create({ email: user.email, // optional name: `${user.first_name} ${user.last_name}`, // optional metadata: { user_id: 'foo' // Or anything else }
})
Source : | Last Update : Sun, 06 Feb 22
Question : stripe create subscription
Answered by : florin-relea
/* 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 })
Source : | Last Update : Sun, 06 Feb 22
Question : How can I get my stripe customer ID?
Answered by : bad-bee-1q4h66s0q1ik
$customer = $stripe->customers()->create([ 'email' => $_POST['stripeEmail'], 'source' => $_POST['stripeToken'], 'plan' => trim($plan) ]);
echo $customer['id'];
Source : https://stackoverflow.com/questions/36939144/how-to-retrieve-the-stripe-customer-id-from-the-stripe-object-after-creation-of | Last Update : Tue, 11 Jan 22