#MDTOHM

1 messages · Page 1 of 1 (latest)

abstract terraceBOT
velvet oak
#

stripe.collectBankAccountForSetup({
clientSecret: result.financial_connection_response.client_secret,
params: {
payment_method_type: 'us_bank_account',
payment_method_data: {
billing_details: {
name: customerName,
email: result.customer.email
},
},
},
expand: ['payment_method'],
})
.then(({setupIntent, error}) => {
if (error) {
console.error(error.message);

} else if (setupIntent.status === 'requires_payment_method') {

} else if (setupIntent.status === 'requires_confirmation') {

** stripe = new \Stripe\StripeClient(stripe_api_key);
stripe->customers->createSource(
'cus_LKrdF3pg9lAgVZ',
['source' => setupIntent.payment_method.us_bank_account.financial_connections_account]
);**
}

#

BOLD - Where I assume this call could be made (cus_LKrdF3pg9lAgVZ ... would be replaced with the customers stripe ID of course

gloomy lodge
#

The Sources API is not use for this with the latest integration pattern (in that doc)

velvet oak
#

Yes thats the code I'm referring to

#

I just snipped out the "collectBankAccountForSetup" part

#

But in the above documentation URL - There is no mention of how to actually STORE the users accounts

#

Putting the system into production, I can console out the "setupIntent" and see the response as expected .... but it doesn't SAVE to the Customer's object within Stripe

#

So I assumed there was some other call in this mix, to actually STORE the account

gloomy lodge
#

Once you finish that flow, it should already be attached to the customer you provided for the setup intent

velvet oak
gloomy lodge
velvet oak
#

Yes, after we complete the flow....we're UNABLE to get the customers account in this method....as its never actually SAVES/STORED in Stripe

gloomy lodge
#

from the end of step 4:

When your customer completes the authentication flow, the PaymentMethod automatically attaches to the SetupIntent, and a Financial Connections account is created.

velvet oak
#

yeah ....odd....not happening

gloomy lodge
#

Can you share an example setup intent?

velvet oak
#

The code (above) or ?

#

How about this

#

Here is a bank account that I verified yesterday

Customer ID - cus_MfnuNFHPZceBLo

gloomy lodge
#

That's a customer, can you share the actual setup intent id? seti_123

velvet oak
#

I have the financial id

#

I didnt log the setup intent id

#

One second, I'll run it again and log

gloomy lodge
#

I'm looking at the one you made most recetnly in test mode

#

Hmm looks like it wasn't confirmed

velvet oak
#

Right

#

So it hits this status - } else if (setupIntent.status === 'requires_confirmation') {

gloomy lodge
#

You do need to take that last confirmation step after the bank details are collected

velvet oak
#

Step 5 is to prompt the user with a CONFIRM form

gloomy lodge
#

Yes, you need to do Step 5 then

velvet oak
#

ok

#

Is there sample code for that (the form itself) ?

#

Just to make a MOCK test

gloomy lodge
#

Sample code for what?

#

There's a snippet in Step 5 showing the Stripe.js call

#

and below there are example mandate text you can use

#

Note that if you use the payment element, this does already include our suggested mandate text

velvet oak
#

Sorry, but isnt' this (below) just the event listener for some type of FORM (confirmation form) ? and the callbacks ?

confirmationForm.addEventListener('submit', (ev) => {
ev.preventDefault();
stripe.confirmUsBankAccountSetup(clientSecret)
.then(({setupIntent, error}) => {
if (error) {
console.error(error.message);
// The payment failed for some reason.
} else if (setupIntent.status === "requires_payment_method") {
// Confirmation failed. Attempt again with a different payment method.
} else if (setupIntent.status === "succeeded") {
// Confirmation succeeded! The account is now saved.
// Display a message to customer.
} else if (setupIntent.next_action?.type === "verify_with_microdeposits") {
// The account needs to be verified via microdeposits.
// Display a message to consumer with next steps (consumer waits for
// microdeposits, then enters a statement descriptor code on a page sent to them via email).
}
});
});

#

I meant is there an example of the FORM that would be displayed/used to prompt the user to actually CONFIRM

#

"Click here to confirm...." Submit

gloomy lodge
#

That's up to you, and for test mode you can just call the confirmation method directly

velvet oak
#

Ah right of course

#

Ok thank you

#

"seti_1LxFo2B0CasBeoGbbB5UNWOL"

gloomy lodge
#

Yep, looks like its succeeded and theres a payment method attached to the customer

velvet oak
#

Yes sir!!! Thank you very much

#

is what I'd use to CALL this account, correct ?

#

As looking in the portal I see "Manadate ID" / "Fingerprint" and an "ID" (starting with "pm_

#

\

gloomy lodge
#

Yea, you use the pm_123 with those future payment intents