#uladzislauchekanau

1 messages · Page 1 of 1 (latest)

bright windBOT
feral root
solar portal
#

Yeah, that's what scares me, cuz I am trying to follow the docs and it's basically not working, and nobody knows how it works and there is no video about it, so I am starting to think that this functionality doesn't work at all

#

Okay, nevermind, thank you 🙂

feral root
#

If you have a specic requests/place you're stuck feel free to ask here and I can try and help

solar portal
#

How can I create an InboundTransfer with bank account? When I try myself I receive
{
"error": {
"message": "BankAccount ba_1NXR9tGawvWgtRr1xytk7U9n must have an active mandate to be valid. Please associate a mandate with this BankAccount by passing mandate_data to SetupIntents. See https://stripe.com/docs/payments/setup-intents#mandates for more information.",
"request_log_url": "https://dashboard.stripe.com/acct_1NXNyFGawvWgtRr1/test/logs/req_psT5pYC5LYzL5V?t=1690216076",
"type": "invalid_request_error"
}
}
But there is no way to assign mandate to a bank account, BankAccount doesn't even have any field related to Mandate

feral root
#

Yeah you wouldn't create the Mandate directly - like we say in the error message and in the docs, you'd want to use a SetupIntent to configure the bank account properly first

solar portal
#

But SetupIntent creates PaymentMethod and not BankAccount

#

And mandate is assigned to PaymentMethod and not BankAccount

feral root
#

You can use the BankAccount (ba_123 ID) you have with a SetupIntent - it'll just configure it to add the mandate and it'll still work with the inbound transfer flow

solar portal
#

How can I assign BankAccount to SetupIntent?

feral root
#

You'd set it as payment_method in the SetupIntent

solar portal
#

But it is payment method and not bank account ;/

#

Okay, maybe another way: is it possible somehow to assign payment method to connected account?

feral root
#

Sorry let me back up

#

BankAccounts are an older API that can be used as multiple things - we allow them to be used as PaymentMethods when properly configured

#

For your flow, the SetupIntent is mainly to properly configure the BankAccount to have a mandate

#

Just because you set it as payment_method doesn't mean that it'll stop working for your inbound transfers

solar portal
#

So after I create bank account I have to once again create setup intent with that bank account in order for it to have mandate?

feral root
#

Yes - or you'd use the SetupIntent directly to create the BankAccount (it'll create it for you, instead of you having to create it separately)

solar portal
#

How can I do this?

feral root
bright windBOT
solar portal
#

But here it only mentions UsBankAccount which not equals to BankAccount object

feral root
solar portal
#

But payment method is attached to customer and not connected account and when I try to create InboundTransfer with pm_** it says it can’t find this PaymentMethod because it is not attached to the connected account

solar portal
feral root
#

We say it right here:
Attach the PaymentMethod to a connected account or platform account if you intend to use the payment method for an inbound transfer or outbound transfer between an external account that belongs to the same business as the Stripe account.

solar portal
#

I saw it 🙂 I have tried passing attach_to_self and on_behalf_of but then I receive the following error on the client side
{
"error": {
"message": "Cannot create a testmode session using a livemode API key, or vice versa.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_tTdxSA5RvZ9djB?t=1690209729",
"type": "invalid_request_error"

#

And it’s actually so broken cuz it says I am using live key but I don’t even have it anywhere

#

And if you ll try follow the link it will not lead to anywhere

feral root
#

Do you have the connected account ID that you tried linking it to?

solar portal
#

Give me a moment please

#

Is it okay if this thread will hang for 10 mins, I am away from my computer rn

#

?

feral root
#

yup go ahead

solar portal
#

Thanks

#

acct_1NXNyFGawvWgtRr1

heavy hawk
#

Hello! I'm taking over and catching up...

solar portal
#

Sure

heavy hawk
#

Okay, so that connected account is connected to your platform in test mode only. For that request to succeed you need to make it using your test API key, not your live API key.

solar portal
#

As I have mentioned, I was not using live key, because I don't even have it 🙂

heavy hawk
#

So you used your platform's test key?

solar portal
#

Yep

#

Request payload: client_secret=seti_1NXPxHKBaG8UnmrcaiT6UFHb_secret_OK45dsJuR3s0n1H99JgravMsZpGQBDN&attach_required=false&payment_method_data[type]=us_bank_account&manual_entry_only=true&key=pk_test_51***
{ message: "Cannot create a testmode session using a livemode API key, or vice versa.", request_log_url: "https://dashboard.stripe.com/test/logs/req_tTdxSA5RvZ9djB?t=1690209729", type: "invalid_request_error" }

#

In the end of payload you can see it's a test key

#

This problem is occurring only when I use attach_to_self: true when creating SetupIntent

heavy hawk
#

What's your ultimate goal? What are you trying to build?

solar portal
#

I want my customers to be able to move money in and out of financial account

#

to/from bank account

heavy hawk
#

Using ACH?

solar portal
#

As far as I know it uses ACH by default for inbound transfers

#

and for Outbound I am providing an ability to choose between ACH and Wire

heavy hawk
#

Why are you setting on_behalf_of to that connected account?

solar portal
#

I thought that's how I attach SetupIntent to the connected account

#

isn't it?

heavy hawk
#

Yeah, it would be, but I don't understand why you're trying to connect this account to a Custom connect account?

solar portal
#

I want to have mandate on the bank account in order to create Inbound Transfer

heavy hawk
#

Oh, so this is the account representing a customer's bank account?

solar portal
#

yes

#

For my customers I have Customer account and connected account with financial account

#

For now, I create SetupIntent to have PaymentMethod attached to the Customer

#

On setup_intent.succeeded I attach externalBankAccount to the connected account of a customer

heavy hawk
#

Instead of using on_behalf_of have you tried making the request/Setup Intent on the connected account instead?

solar portal
#

If you mean via Stripe-Account header - yes

heavy hawk
#

Same error or different with that approach?

solar portal
#

I don't remember actually, lemme do this again

#

What's the purpose of on_behalf_of then?

heavy hawk
#

You have to create the Setup Intent on the connected account.

#

on_behalf_of is when you have the Setup Intent on your platform but you want a connected account to be the merchant of record.

solar portal
#

I see, thanks

heavy hawk
#

If the Setup Intent is on the connected account then it's the merchant of record without you having to do anything extra.

solar portal
heavy hawk
#

Right, but you need to create the Setup Intent on the connected account.

#

Right now you're using a client secret that belongs to a Setup Intent that exists on your platform account.

#

When you try to use that Setup Intent's client secret on a connected account you get the error above because the Setup Intent doesn't exist on that connected account.

solar portal
#

How do I create it on the connected account then?

heavy hawk
#

You use the Stripe-Account header when creating the Setup Intent.

solar portal
#

But that's what I am doing rn

#

this is the error I get

#

on the FE

heavy hawk
#

Yeah, so you have a client secret, where did that come from?

solar portal
#

From my rest api

#

I generate it on the BE and then I pass it to the FE

heavy hawk
#

Right. So did you modify your backend code to create the Setup Intent on the connected account?

solar portal
#

yes

heavy hawk
#

Or is it still creating the Setup Intent on your platform account?

solar portal
#

I am passing Stripe-Account now

heavy hawk
#

So it looks like this second request to get an elements session is taking place on your platform account, not the connected account.

#

You need to add the Stripe-Account header there as well, since this needs to happen on the connected account where the Setup Intent is.

solar portal
#

I have to pass the connected account id on the FE also somehow?

heavy hawk
#

Yes.

solar portal
#

I see

#

Lemme try it

#

At least the form didn't fail now, but still I have one error but it's not related to current issue ig, I'll ask our FE engineer to help me proceed

#

Thank you a lot!