#aminos20220

1 messages · Page 1 of 1 (latest)

spark merlinBOT
drifting nacelle
#

Hi there!

crystal wharf
#

Hi soma

#

can you give me 10 minutes i will try this and get back to you ?

drifting nacelle
#

Sure!

crystal wharf
#

thank you

#

where do I import element from ?

drifting nacelle
#

what do you mean?

#

You should already have a code to create the Element on your page elements.create(...). Update this code to disable wallets.

crystal wharf
#

i tried this : const elements = useElements();
var paymentElement = elements.create("payment");

drifting nacelle
#

Wait, did you create the Payment Element in the screenshot you shared above?

crystal wharf
#

I used this code :

#

var elements = useElements();

#

const stripe = useStripe();

#

stripe
.confirmPayment({
elements,
redirect: "if_required",
confirmParams: {
payment_method_data: {
billing_details: {
name: user.firstName.toUpperCase() + " " + user.lastName,
email: user.email,
phone: user.phone.number,
},
},
},
})

drifting nacelle
#

This is the code to confirm the PaymentIntent. You don't need to change this

crystal wharf
#

ok

drifting nacelle
#

You need to find the code that creates the Payment Element on your page

crystal wharf
#

I just imported PaymentElement from "@stripe/react-stripe-js"

#

import {
PaymentElement,
useStripe,
useElements,
} from "@stripe/react-stripe-js";

#

is this the right way ?

drifting nacelle
#

I don't understand your question, sorry.

#

This code is not creating the Payment Element on the page

#

Are you a software developer?

crystal wharf
#

yes I am, i am a beginner

drifting nacelle
#

You already have a code like this on your page: elements.create('payment') to create the Payment Element
You need to edit it to something like this: elements.create('payment', {wallets: {applePay: 'never', googlePay: 'never'}})

crystal wharf
#

No I don't have a code like this

drifting nacelle
#

Oh you are using React?

crystal wharf
#

can you please redirect me to an example using this code ?

#

Next js

#

I create a payment intent using stripe.paymentIntents.create

#

then I use : const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_API_KEY);

#

call the API

drifting nacelle
#

Okay, so you probably have a code like this: <PaymentElement />

crystal wharf
#

yes <Elements options={options} stripe={stripePromise}>
<CheckoutForm
booking={booking}
setBooking={setBooking}
availableRooms={availableRooms}
amountToPay={amountToPay}
bookingData={bookingData}
clientStripeID={clientStripeID}
user={user}
/>
</Elements>

#

in the checkout form

drifting nacelle
#

And you want tot change it like this: ``<PaymentElement options={...} />`

crystal wharf
#

<PaymentElement id="payment-element" />

drifting nacelle
#

And in ... you remove the wallets

crystal wharf
#

how do I use options to do that ?

#

<PaymentElement id="payment-element" options={{ wallets: null }} />

#

is this correct

drifting nacelle
#

Something like this (I haven't tested this code): `<PaymentElement options={{wallets: {applePay: 'never', googlePay: 'never'}}} />

crystal wharf
#

I will test it and get back to you

#

thank you

drifting nacelle
crystal wharf
#

It worked perfectly

#

thank you

#

And sorry for all the questions I asked