Last active
April 3, 2021 19:15
-
-
Save tanvirstreame/f783f41923079427656bbd3fa8acc1a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const stripe = require('stripe')((process.env.STRIPE_PRIVATE_SECRET)); | |
| productList.forEach(element => { | |
| line_items.push({ | |
| price_data: { | |
| currency: 'usd', | |
| product_data: { | |
| name: element?.name, | |
| }, | |
| unit_amount: Math.ceil((finalPrice / 85) * 100 ), // If bangladeshi currency | |
| }, | |
| quantity: 1, | |
| }) | |
| }); | |
| const session = await stripe.checkout.sessions.create({ | |
| success_url: 'https://example.com/success', | |
| cancel_url: 'https://example.com/cancel', | |
| payment_method_types: ['card'], | |
| line_items, | |
| mode: 'payment', | |
| client_reference_id: "You can use order id here" | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment