#darthvader2.0.

1 messages · Page 1 of 1 (latest)

sleek girderBOT
sinful moon
#

We don't recommend storing client secrets in a database. Those are intended only for the client.

As for incomplete Subscriptions, I would say it's a matter of preference for how you handle those. A user with their own custom login portal with a shopping cart view might prefer to store those and surface them in the user's shopping cart on their website. That might be a lot of work for a different user that only wants to show the customer their acive subscriptions. It depends on what your desired flow is

shut raptor
#

Hi @sinful moon,

Appreciate your response! My concern revolves around a scenario where I initiate a session to purchase my subscription multiple times (let's say 5). This is necessary on the frontend to obtain the client secret. However, in Stripe, it results in the creation of 5 incomplete subscriptions. When the subscription is finally purchased on the 5th attempt, it leaves me with 4 incomplete subscriptions and only one active.

I'm curious if it's advisable, perhaps through a cron job or similar mechanism, to automatically clear those incomplete subscriptions that haven't been finalized. Any thoughts or recommendations on handling this situation?

#

Because that date is not needed anymore also what should I do when let's say I wanna render the <CardElement /> witch also needs a client_secret? I create another incomplete subscription or what?

sinful moon
#

You could create a cron job that deletes orphaned subscriptions, that would work fine. That being said, you might consider creating the subscription when the customer is checking out. So only create the Subscription once they navigate to the payment flow and are ready to pay.

shut raptor
#

But what I do with the <CardElement/> from React witch needs a client_secret also?

sinful moon
#

I don't think the Card Element takes a client secret, does it?

shut raptor
#

Yes

#

Needs <Elements />

#

Witch requires client secret

sinful moon
#

Ah, it doesn't necessarily require it, since you can create Elements objects without them. All the same, though, you can just create your Setup Intent right before rendering the card element

shut raptor
#

What elements object means? Can you explain please?

sinful moon
shut raptor
#

Ah, ok, I see it's optional ... Have to test to see if my payment method is saved

#

by any chance do you have for React any usefull link how the CardElement should be implemented?

sinful moon
#

If this is a net-new integration (i.e. you don't have any exisitng card element integration) I would recommend not using the Card Element at all, since it's a legacy technology. The recommended integration path is the Payment Element, which is much better documented and easier to use: https://stripe.com/docs/payments/quickstart

Learn how to embed a custom Stripe payment form in your website or application. Build a checkout form with Elements to complete a payment using various payment methods.

shut raptor
#

ok, but what I wanna do initially is for the user be able to manage his payment methods

sinful moon
#

How were you planning to do that with the Card Element?

shut raptor
#

I thought would be possible, is not?

sinful moon
#

It depends on what you mean by "manage his payment methods".

shut raptor
#

Add new payment methods, make one default, delete payment methods even may update existing one?

#

I wanna collect the details of the cards and using the CardElement or the subcomponents would make sense, right?

sinful moon
#

Payment Element would allow you to do the same things as the Card Element, except better. As for updating that information, that's going to be a lot of custom code either way. You would need to build a view where your customer logs in. Once their, your system would need to be able to retrieve the Customer's payment methods via a back-end API call (https://stripe.com/docs/api/payment_methods/customer_list), and render them on the screen with more custom code. There isn't an front-end Element or UI component for rendering this information through Stripe

shut raptor
#

the Payment Element is not supposed to only collect payments?

#

I mean I guess not?

sleek girderBOT
sinful moon
#

It definitely is used to collect payments and payment methods, but it's not used to delete or modify payment methods

shut raptor
#

for delete and modifiy, yah, would make sens to be via API request

#

I agree

#

The payment element uses the client_secret to load the payment_methods allowed, right? Like card payment, paypal etc, right?

soft berry
#

Yep

#

The payment methods on the payment intent are what are used

shut raptor
#

Hello, @soft berry

#

damn the PaymentElement requires the client_secret since I get an error

#

of

soft berry
#

what?

shut raptor
#

Uncaught IntegrationError: In order to create a payment element, you must pass a clientSecret or mode when creating the Elements group.

soft berry
#

Yep

#

If you don't pass client secret you must pass mode

shut raptor
#

and what's the mode for adding to stripe new payment methods for one customer

#

?

soft berry
#

Wait why aren't you passing client secret?

shut raptor
#

let me try

soft berry
shut raptor
#

ok, yap

#

so always I need setup intents for new payment methods

soft berry
#

If you want to attach them to a customer and not charge them right away, then yes you should use setupintent

shut raptor
#

I just wanna let them add more than one payment mothod since in time the can change

#

so using the setup intent client secret is the way to go always?

soft berry
#

If you want to attach them to a customer and not charge them right away, then yes you should use setupintent

#

If you want to charge them and attach payment method at the same time, then paymetn intent should be used instead

shut raptor
#

got it thanks

#

and with what method I should use when submitting the form?

#

createPaymentMethod?

soft berry
#

No...

#

Did you click the link I sent you?

#

It shows you how to do everything

#

Step 6

shut raptor
#

confirmSetup