#vasynyt-sepa
1 messages · Page 1 of 1 (latest)
hmm. not sure I follow
by billing dashboard do you mean the portal ? https://stripe.com/docs/billing/subscriptions/integrating-customer-portal
Yes indeed!
it only supports cards unfortunately : https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#limitations so yes you can't update a SEPA Debit payment method through it
How can I update a customers bank account if they for example switch banks and the account number gets changed?
you'd have to build it yourself (i.e use https://stripe.com/docs/payments/sepa-debit/set-up-payment and then update the customer's default subscription payment method to the new one)
I've already built this myself, but I thougth I should use the portal to update the details. Seems that I can just let the users update the banking details by going thourgh the set up flow again?
not sure what you call "the set up flow" but I think the answer is yes?
main thing is to make sure you set either https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method or https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method after the customer has addd the new SEPA Debit payment method if you intend to use it for their future recurring payments
I'm using the checkout to add the payment details so I suppose these are updated automatically?
they're not
assuming you mean you are using Checkout in mode=setup
it just adds the payment method but you have to mark them as default
we have a guide on the overall flow for using Checkout to update a subscription's details (https://stripe.com/docs/payments/checkout/subscriptions/update-payment-details#set-default-payment-method)
I haven't added the payment method as default and it has been working as expected still? I suppose this is due to the customer only having one payment method?
hard for me to say without looking at the specific examples
but no I wouldn't expect it to work, we don't just charge the one payment method the customer has, you still have to explicitly set it as a default
def create_checkout_session
customer = if !current_user.stripe_id
Stripe::Customer.create(
email: current_user.email
)
else
Stripe::Customer.retrieve(
current_user.stripe_id
)
end
current_user.update!(stripe_id: customer.id)
checkout_session = Stripe::Checkout::Session.create({
mode: "setup",
payment_method_types: ["sepa_debit"],
customer: customer.id,
success_url: root_url + "payment",
cancel_url: root_url + "payment",
locale: "fi"
})
redirect_to checkout_session["url"], status: 303
end
This is what I have and I can confirm that the user can make payments after setting this up
do you have an example sub_xxx where you updated the customer in this way and then a subsequent recurring payment worked?
I don't have subscriptions, but this is an user id with such account cus_KhkhPQ8rXWatiE
And this is a payment intent made by this customer pi_3K2LFmACGm8HkR750JF0Khsb
yeah, you pass the payment method on the PaymentIntent : https://dashboard.stripe.com/test/logs/req_1dVldOyi3e8prl so naturally it works
weren't we talking about subscriptions though?
or do you do the subscriptions yourself, like you have your own recurring logic and create PIs directly
Ah I see. No I'm not using subscriptions. I have customers and connect accounts and payment intents between them. The customers can only make the payments with SEPA banking accounts though.
def call
Stripe::PaymentIntent.create({
payment_method_types: ["sepa_debit"],
payment_method: payment_method_id,
confirm: true,
off_session: true,
customer: @offer.user_stripe_id,
amount: @offer.amount * 100,
currency: "eur",
application_fee_amount: @offer.amount * 4,
metadata: metadata,
transfer_data: {destination: @rental.user_merchant_id}
})
end
ok then everything I said is irrelevant
that default_payment_method only applies if you're using our Subscriptions API
I see. Perhaps I should have given more detailed question.
if you create your own PaymentIntents then you have to pass a PaymentMethod ID explicitly in your code so whatever logic you have in place for picking payment_method_id in that code is what controls things
So yeah the "problem" is that I would like to update the customers SEPA details if they happen to get a new bank account.
I was just confused because you said you're using the Billing portal which is usually for managing Subscriptions
Yeah it seems that it's not relevant for me here otherthan for updating some customer details.
then as I said, https://stripe.com/docs/payments/sepa-debit/set-up-payment . If you're not using Subscriptions then you don't need to set a default_payment_method after that
But can I do this setup more than once per customer? Since they have already done it at some point it seems that they can only add more payment methods, but not override the current one.
In this case it seems that whenever I add another payment method I should handle it as such so that it's the default one.
This cannot be handled in the Stripe::Checkout::Session.create directly?
you can do it as many times as you
like up to a point (there is some limit to the number of PaymentMethods a customer can have, I think it's 200)
that is definitely an option yes! Checkout adds the new PaymentMethod, if you want, you can detach the old one and update your database or whatever logic you have to now use the new one in any future payments
no, it just adds a new one, that's it
and yes you can't edit the details of existing PaymentMethods to change the IBAN or so on, it would be a new PaymentMethod object