#tomh0027
1 messages · Page 1 of 1 (latest)
You'll need the public key in order to create a Stripe Element
with a payment/setup intent client_secret
what I am trying to do is enable subscription on React app
my approach is let users submit their email and other info in the form below
then create customer on backend, and then create subscription with the created customer id
as I read the stripe doc, client secret is then obtained from the created subscription
here my question is can I create payment element or card element without passing the client secret to Stripe element options?
but I have this error
Are you following the guide I'm sharing with you ?
this is a bit different from what I am going to do
I created subscription products on my dashboard and I am using the price id to create subscription
here is the code snipet
const subscription = await stripe.subscriptions.create({ customer: customerId, items: [{ price: priceId }], payment_settings: { save_default_payment_method: "on_subscription", }, payment_behavior: "default_incomplete", expand: ["latest_invoice.payment_intent"], });
this is a bit different from what I am going to do
That's the only way to mount Element without having an intent client secret
one of your staff told me that I don't need to create payment intent for subscription because it automatically does for subscription
and I got the above code from the link he sent
yes you don't need to create a PaymentIntent with subscription
But I'm referring to this guide:
https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
Where are you seeing that a PaymentIntent is created separatly ?
I was going to pass the client secret to Stripe element option
but PaymentElement didn't render without client secret
so I got stuck
It can be rendered without client_secret
Check the guide I'm sharing with you, in particular this step:
https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription#web-collect-payment-details
in that case, can I see all the subscribed users on my dashboard?
Yes.
ok, let me try
and I found the bot automatically archive the thread after some time
can I continue here if I have sth to ask you?
Yes this thread will be closed shortly due to inactivity. Don't hesitate to reach out in the main channel with your follow up question in case.
Yes what is the issue ?
I passed this as options to Stripe element
const options = { mode: "subscription", amount: 999, currency: "usd", appearance: { theme: "stripe", }, variables: { colorBackground: "red", }, };
but background color of inputs doesn't change
I tried with hex color, #ff0000
it didn't work either
oh, my bad
I fixed the error
I had to put variables inside appearance object
but quick question is does it accept hex color only?
is it possible to make it transparent background?
You are not passing the .Input rule:
https://stripe.com/docs/elements/appearance-api?platform=web#rules
Try this