#bilal-recurring-payments
1 messages ยท Page 1 of 1 (latest)
bilal-recurring-payments
@obtuse nacelle looks to me like you want Billing to do recurring charges really https://stripe.com/docs/billing/subscriptions/build-subscriptions
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
So what's the problem exactly? What have you tried?
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.
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?
Get the success response ,Give me 1 min will share with you
no need to share, just look at it first as the developer to try and debug what's happening
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 ?
It does?
You now have a Customer that has a saved card PaymentMethod already
https://dashboard.stripe.com/test/setup_intents/seti_1NL81eKv7Wi3E5ylT1qf5Per this is the SetupIntent in your example above. It links to the associated Customer straight from that page and that Customer has a saved card as expected
Yes I see that my bad .
But why it is not the default payment method ?
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
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 ?
Setup Intents would have a Customer on them: https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you please share the reference for to set default payment method ?
On the Customer: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
On the Subscription: https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thank you ๐