#bilal-recurring-payments

1 messages ยท Page 1 of 1 (latest)

smoky dustBOT
wind hazel
#

bilal-recurring-payments

obtuse nacelle
#

No Its not a fixed priced thing.

#

They can also buy things daily and get charged immediately from the method they have stored.
And there are some cases in which they will get charged weekly(not fixed price).
How can I do that with SetupIntent & PaymentIntent ?

#

Before that I was using charge API

wind hazel
#

So what's the problem exactly? What have you tried?

obtuse nacelle
#

I was trying this in the backend
customer = Stripe::Customer.create() @customer_id = customer.id intent = Stripe::SetupIntent.create({customer: @customer_id })
and in front-end with card
const result = await this.stripe.confirmCardSetup(this.intent, { payment_method: { card: this.card, }, })

#

But the customer on stripe is empty row.

wind hazel
#

Cool so you have real code. Did you debug it?

#

Like what is the value of customer.id and intent.id? What do you see in your logs? What do you see in the API response?

obtuse nacelle
#

Get the success response ,Give me 1 min will share with you

wind hazel
#

no need to share, just look at it first as the developer to try and debug what's happening

obtuse nacelle
#

I did but not sure what I'm missing like getting this response
{ "setupIntent": { "id": "seti_1NL81eKv7Wi3E5ylT1qf5Per", "object": "setup_intent", "automatic_payment_methods": null, "cancellation_reason": null, "client_secret": "seti_1NL81eKv7Wi3E5ylT1qf5Per_secret_O7MlV9aYHLY4DIx32Q0yii3NLA8BQHa", "created": 1687280850, "description": null, "last_setup_error": null, "livemode": false, "next_action": null, "payment_method": "pm_1NL822Kv7Wi3E5ylarmcYgZ0", "payment_method_types": [ "card" ], "status": "succeeded", "usage": "off_session" } }
Shouldnt after that I have a customer created with the card details on the stripe customer dashboard ?

wind hazel
#

It does?

#

You now have a Customer that has a saved card PaymentMethod already

smoky dustBOT
obtuse nacelle
#

Yes I see that my bad .
But why it is not the default payment method ?

weary trench
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

You have to explicitly set it as the default either on the Customer object or the Subscription object

obtuse nacelle
#

Thank you , one more question can I retrieve a customer from setupIntent ID or from client_secret or it can only be retrieved through customer ID ?

weary trench
obtuse nacelle
#

Can you please share the reference for to set default payment method ?

weary trench
obtuse nacelle
#

Thank you ๐Ÿ™‚