Skip to content

Commit

Permalink
revert all changes for paypal and change payer email into only email
Browse files Browse the repository at this point in the history
  • Loading branch information
ih-abir committed Feb 8, 2024
1 parent 1903d63 commit 9e5742b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/workers/dilmahtea-me-stripe/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ const handlePOST = async (request, env, ctx) => {
// Create new Checkout Session for the order.
// Redirects the customer to s Stripe checkout page.
// @see https://stripe.com/docs/payments/accept-a-payment?integration=checkout
// const paymentMethod = await stripe.paymentMethods.create({
// type: 'paypal',
// paypal: {
// payer_email: email,
// },
// });
const paymentMethod = await stripe.paymentMethods.create({
type: 'paypal',
paypal: {
email: email,
},
});

function convertPriceToCents(price, quantity = 1) {
return Math.round(price * quantity * 100);
Expand All @@ -100,10 +100,12 @@ const handlePOST = async (request, env, ctx) => {
const paymentIntent = await stripe.paymentIntents.create({
customer: customer.id,
payment_method_types: ['paypal'],
// payment_method: paymentMethod.id,
payment_method: paymentMethod.id,
amount: totalAmount,
currency: 'eur',
metadata: { paymentID, payment_type },
confirm: true,
cancel_url: cancel_url,
return_url: successUrl,
});

Expand Down

0 comments on commit 9e5742b

Please sign in to comment.