#tomh0027

1 messages · Page 1 of 1 (latest)

fresh sandBOT
vestal wigeon
#

You'll need the public key in order to create a Stripe Element

#

with a payment/setup intent client_secret

cinder mango
#

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?

cinder mango
#

but I have this error

vestal wigeon
#

Are you following the guide I'm sharing with you ?

cinder mango
# vestal wigeon yes you can : <https://stripe.com/docs/payments/accept-a-payment-deferred?platfo...

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"], });

vestal wigeon
#

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

cinder mango
#

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

vestal wigeon
#

yes you don't need to create a PaymentIntent with subscription

cinder mango
#

I was going to pass the client secret to Stripe element option

#

but PaymentElement didn't render without client secret

#

so I got stuck

vestal wigeon
#

It can be rendered without client_secret

cinder mango
#

in that case, can I see all the subscribed users on my dashboard?

vestal wigeon
#

Yes.

cinder mango
#

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?

vestal wigeon
#

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.

cinder mango
#

thanks

#

and I have trouble with customizing the apperance

vestal wigeon
#

Yes what is the issue ?

cinder mango
#

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?

vestal wigeon
#

Try this

cinder mango
#

wow, it works

#

thanks a lot