#Batsare - SEPA
1 messages · Page 1 of 1 (latest)
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 ?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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 ?
It work for me
you don't need to pass the mandate ID
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
Okay but i use "on_behalf_of" for payment intent
i need to run a new setup intent for each connected account ?
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
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.
No error given, just no mandate data saved on Stripe.
@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
Oh sorry, this question was not for me ?
How can i verify if mandate exist for connected account ?
It's best to store that context in your own database so you know which connected account + payment methods are available
in the API itself it's not easy, the only way to know if a mandate exists for a given payment method is to look for SetupIntents that succeeded for it : https://stripe.com/docs/api/setup_intents/list#list_setup_intents-payment_method (and then check if https://stripe.com/docs/api/setup_intents/object#setup_intent_object-mandate exists)
Okay, thank you.
For the credit cards, I don't need to redo a setup intent for each account connected ?
no