#jitendra_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1399720578918908076
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
how can i setup conditional payment methods? when customer first time purchase then i want only card option but if he is already client and try to second purchase then want card and SEPA both as payment method
There is no built feature for this in Stripe APIs. You need to do this check before initializing the PaymentElement..
You check if the customer have an existing Subscription or not
how can i check before initiate payment element?
hi there!
you can list the Subscription of an existing Customer with this endpoint: https://docs.stripe.com/api/subscriptions/list
I don't understand your question, sorry.
import {useStripe, useElements, PaymentElement} from '@stripe/react-stripe-js';
const elements = useElements();
const {error, paymentMethod} = await stripe.createPaymentMethod({elements});
this API returning payment methods. should i setup anything in elements so it will return only requird payment methofs?
I don't understand sorry. what do you mean by "required payment method"?
i mean card or sepa
can you explain in a full paragraph exactly what you are trying to do?
i am using @stripe/react-stripe-js and @stripe/stripe-js
i did implementation based on https://docs.stripe.com/sdks/stripejs-react#setup guideline
i am using custom checkout page by Stripe
by default when checkout screen load its showing Card and SEPA as payment options
i want them conditionally in some cased i need only Card and in some cases card and sepa both
is there any way i can show/hide payment methods?
sure, you can set the payment method when creating the Checkout Session: https://docs.stripe.com/api/checkout/sessions/object?api-version=2025-05-28.basil&lang=curl#checkout_session_object-payment_method_types
i am not initializing any checkout sessions
i think i find solution
when we create <Elements stripe={stripeKey} options={options} /> at that time we can pass options array if paymentMethodTypes
import {Elements} from "@stripe/react-stripe-js";
const [options, setOptions] = useState({
mode: 'payment',
currency: 'eur',
locale: language,
setupFutureUsage: 'off_session',
paymentMethodCreation: 'manual',
appearance: {
theme: 'stripe',
},
paymentMethodTypes: ['card','sepa_debit']
})
can you please tell me what's value for google pay and apple pay i tried google_pay and apple_pay but its not working
oh, you are using the defered intent flow? in this case yes you can use paymentMethodTypes on the Payment Element
can you please tell me what's value for google pay and apple pay i tried google_pay and apple_pay but its not working
there isn't a value for Apple/Google Pay. they are automatically included when you usecard.
ok then how can i test it?
test what?
you need to check all requirements here: https://docs.stripe.com/testing/wallets?ui=payment-element#device-requirements