-
-
Save chrisidakwo/d2fd99600a1ba8221578c0ddcc17efec to your computer and use it in GitHub Desktop.
Create checkout with dynamic product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return stripe.checkout.sessions.create({ | |
mode: 'subscription', | |
customer: stripeCustomerId, | |
payment_method_types: ['card'], | |
line_items: [ | |
{ | |
price_data: { | |
currency: 'usd', | |
unit_amount: productPrice, | |
product_data: { | |
name, | |
description, | |
images: [image], | |
}, | |
recurring: { | |
interval: input.interval, | |
}, | |
}, | |
quantity: 1, | |
}, | |
], | |
success_url: `${baseUrl}/payment/success`, | |
cancel_url: `${baseUrl}/payment/cancel`, | |
allow_promotion_codes: true, | |
automatic_tax: { | |
enabled: true, | |
}, | |
customer_update: { | |
address: 'auto', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment