#vasynyt-sepa

1 messages · Page 1 of 1 (latest)

vivid pollen
#

hmm. not sure I follow

analog olive
#

Yes indeed!

vivid pollen
#

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)

analog olive
#

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?

vivid pollen
#

not sure what you call "the set up flow" but I think the answer is yes?

analog olive
#

I'm using the checkout to add the payment details so I suppose these are updated automatically?

vivid pollen
#

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

analog olive
#

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?

vivid pollen
#

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

analog olive
#
  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

vivid pollen
#

do you have an example sub_xxx where you updated the customer in this way and then a subsequent recurring payment worked?

analog olive
#

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

vivid pollen
#

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

analog olive
#

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
vivid pollen
#

ok then everything I said is irrelevant

#

that default_payment_method only applies if you're using our Subscriptions API

analog olive
#

I see. Perhaps I should have given more detailed question.

vivid pollen
#

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

analog olive
#

So yeah the "problem" is that I would like to update the customers SEPA details if they happen to get a new bank account.

vivid pollen
#

I was just confused because you said you're using the Billing portal which is usually for managing Subscriptions

analog olive
#

Yeah it seems that it's not relevant for me here otherthan for updating some customer details.

vivid pollen
analog olive
#

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?

vivid pollen
vivid pollen
vivid pollen
#

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