#abeng_best-practices

1 messages · Page 1 of 1 (latest)

storm torrentBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1475862695310921900

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

thick nimbus
#

Hey there, what is you goal here? Because if the intent is to be able to debit the bank account later then yes you should complete the SetupIntent up front when you collect the bank details from the customer.

#

If you dont do that, you won't have a mandate for those future debits and will need to get your customer back on session to complete that before debiting

spiral current
#

Management wants to delay sending microdeposits until the user has an enrollment to actually use the bank account for. So they essentially want to trigger microdeposits themselves instead of doing it right away.

thick nimbus
#

In the docs it says to not maintain long-lived unconfirmed setupintents
Can you point me to the docs you're reading where we say this so i can review context?

spiral current
#

“Don’t maintain long-lived, unconfirmed SetupIntents because they might not be valid.”

thick nimbus
#

Some payment methods have flows that must be completed promptly, but us bank accounts arent one of those, you can confirm details later

#

Do they understand that with such a flow, it will require future customer action to validate the bank account before debitting, and they may find some account are invalid at that time?

#

(instead of front loading this flow)

spiral current
#

Yeah, it’s what they currently have implemented at the moment using the old token and sources API.

#

So essentially, do I just store/create the payment method id? and create and confirm a setup intent later when they’re ready to send microdeposits?

#

or is there like no other way to do this with the new APIs?

thick nimbus
#

Are you using payment element to collect the bank details, or your own form fields to get the routing/account numbers?

spiral current
#

Using our own form fields

thick nimbus
#

And, are you presenting mandate terms to the customer in your flow, about how you're going to debit in future?
https://docs.stripe.com/payments/ach-direct-debit#mandates

Accept US bank debits on Stripe using ACH Direct Debit. ACH lets you accept payments from customers with a US bank account. This guide describes ACH Direct Debit and helps you choose the best bank debit type for your business.

#

(i ask because it influences the flow i will suggest)

spiral current
#

Yes, we have a checkbox stating the terms for when debits will be made

thick nimbus
#

So in this case at collection time you need to do two things:
1/ record the customer ip & user agent for that mandate collection to provide later
2/ record those collected bank account details or create a payment method:
https://docs.stripe.com/api/payment_methods/create#create_payment_method-us_bank_account

curl --request POST \
  --url https://api.stripe.com/v1/payment_methods \
  -u sk_test_123: \
  --data type=us_bank_account \
  --data 'billing_details[email]=email@example.com' \
  --data 'billing_details[name]=owner name' \
  --data 'us_bank_account[account_holder_type]=individual' \
  --data 'us_bank_account[account_number]=000123456789' \
  --data 'us_bank_account[routing_number]=110000000'

and you'll get a pm_123 object, not attached to a customer yet

storm torrentBOT
thick nimbus
#

Later, when you're ready to trigger the confirmation and microdeposits to verify the account and set up the mandate, you create & confirm a setup intent with that PM and the mandate details you collected earlier, specifying the microdeposit method for verification
Mandate params: https://docs.stripe.com/api/setup_intents/create#create_setup_intent-mandate_data-customer_acceptance-online
Verification method: https://docs.stripe.com/api/setup_intents/create#create_setup_intent-payment_method_options-us_bank_account-verification_method

Looks like this:

curl --request POST \
  --url https://api.stripe.com/v1/setup_intents \
  -u sk_test_123: \
  --data 'payment_method_types[]=us_bank_account' \
  --data 'payment_method_options[us_bank_account][verification_method]=microdeposits' \
  --data 'mandate_data[customer_acceptance][type]=online' \
  --data 'mandate_data[customer_acceptance][online][ip_address]=1.1.1.1' \
  --data 'mandate_data[customer_acceptance][online][user_agent]=some_user_agent' \
  --data confirm=true \
  --data 'usage=off_session' \
  --data payment_method=pm_123 \
  --data customer=cus_123