#Batsare - SEPA

1 messages · Page 1 of 1 (latest)

hazy wolf
#

Hi! Can you clarify your question?

frank widget
#

I can help, I made the same with SEPA mandates. You have to create "source" and not a "payment intent" to give the mandate properties to Stripe

#
  def make_default
    customer = Stripe::Customer.retrieve(context.customer_stripe_id)

    customer.source = context.bankaccount.id
    customer.save
  end

  def sepa_debit
    { iban: iban }
  end

  def metadata
    { app_id: id }
  end

  def billing_details
    {
      email: user.email,
      name: user.full_name,
      phone: user.phone_number,
    }
  end

  def mandate
    {
      currency: DEFAULT_CURRENCY,
      notification_method: 'email',
      acceptance: {
        type: 'online',
        date: Time.now.to_i,
        ip: user.current_sign_in_ip,
        user_agent: user.current_user_agent || DEFAULT_USER_AGENT,
        online: {
          ip: user.current_sign_in_ip,
          user_agent: user.current_user_agent || DEFAULT_USER_AGENT,
          date: Time.now.to_i,
        },
        status: 'accepted',
      },
    }
  end

  def create_stripe_payment_method
    Stripe::Source.create(
      sepa_debit: sepa_debit,
      type: 'sepa_debit',
      owner: billing_details,
      metadata: metadata,
      mandate: mandate,
      currency: DEFAULT_CURRENCY,
    )
  end
#

Here my Ruby code to create a SEPA stripe source with a mandate

#

Why not use Payment Intent ?

frank widget
#

Because the mandate should be filled by the user, and can not be automated with an Intent

#

The Stripe API didn't have inputs to do give mandate data on payment intent, only in source

#

I know, but it doesn't work

#

This documentation is wrong

#

I'd already mention this to Stripe (without any response or changes)

#

Oh ...

#

In your example, you pass mandate ID ?

strong ruin
#

what error did you get?

frank widget
#

It work for me

strong ruin
#

if you collected the mandate when you created the PaymentMethod and saved it to the customer object, we know the mandate and it will just work

frank widget
#

Okay but i use "on_behalf_of" for payment intent

#

i need to run a new setup intent for each connected account ?

strong ruin
#

you would yes

#

since the mandate is tied to the merchant account processing the payment

#

so you can't do a SetupIntent on the platform, then process the PaymentIntent on_behalf_of various connected accounts, it just doesn't work

frank widget
# strong ruin can you explain?

You cannot collect yourself the mandate online or offline data then give them on a payment intent. I'd tried many times last year, and it never works, no mandate was registred. So perhaps it have been fixed since my last attempt 1 year ago, I didn't retry since, I works with Stripe source now.

frank widget
strong ruin
#

@frank widget can we not talk about this in this thread?

#

if you have your own question please ask it in the main channel and I'll open a thread with you, it's confusing to have multiple unrelated people discussing issues in one thread :p

frank widget
frank widget
strong ruin
frank widget
#

Okay, thank you.
For the credit cards, I don't need to redo a setup intent for each account connected ?

strong ruin
#

no