#siddarth_api

1 messages ยท Page 1 of 1 (latest)

hollow lichenBOT
#

๐Ÿ‘‹ 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/1311305463257632798

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

maiden peak
#

๐Ÿ‘‹ happy to help

#

the SetupIntent still needs authorization

#

basically it's in a requires_action state

inner parrot
#

how to do it? any code snippet

#

Step1: created Setup intent and attached customer to it. saving the customer and payment methos=d for late use in payment intent.

var options = new CustomerCreateOptions();
var service = new CustomerService();
var customer = await service.CreateAsync(options);

var setupIntentOptions = new SetupIntentCreateOptions
{
Customer = customer.Id,
PaymentMethodTypes = new List<string> { "us_bank_account" },
PaymentMethodOptions = new SetupIntentPaymentMethodOptionsOptions
{
UsBankAccount = new SetupIntentPaymentMethodOptionsUsBankAccountOptions
{
VerificationMethod = "microdeposits",//"instant", //"microdeposits"
FinancialConnections = new SetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsOptions
{
Permissions = new List<string> { "payment_method", "balances" },
},
},
},
};
var setupIntentService = new SetupIntentService();
var setupIntentResult = await setupIntentService.CreateAsync(setupIntentOptions);

#

step2: Making call to confirmUsBankAccountSetup by colecting the routing and account number.
let result = await stripe.confirmUsBankAccountSetup(
setupIntent.client_secret,
{
payment_method: {
us_bank_account: {
routing_number: routingNumber,
account_number: accountNumber,
account_holder_type: 'individual', // 'individual' or 'company'
},
billing_details: {
name: 'test',
email: $('#tbEmail').val(),
},
},
}
);

#

Step3: Making a payment as below using the cutomer and payment method
string post_url = "https://api.stripe.com/v1/payment_intents";
bool IsApproved = false;
var restClient = new RestClient(post_url);
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", $"Bearer {Username}"); //Security key
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");

request.AddParameter("amount", (long?)amount * 100);
request.AddParameter("currency", "usd");
request.AddParameter("confirm", "true");
request.AddParameter("customer", customerid);
request.AddParameter("payment_method", paymentmethodid);
request.AddParameter("payment_method_types[0]", "us_bank_account");

Getting an error as
Status : invalid_request_error,
Response Message : The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.,

#

am I missing any steps here

maiden peak
#

you have chosen to verify the ACH DD with microdeposits (ie verification_method: "microdeposits",)

inner parrot
#

What is the step I am missing, I am not able to understand the complete flow in the document. what if i want to do instant verification without microdeposit also

maiden peak
#

you just need to replace verification_method: "microdeposits" with verification_method: "instatnt"

inner parrot
#

if i use verification_method: "instatnt" do I need to make any code change then?

maiden peak
#

I'm not sure what's your code, but I would first try that and see what happens

inner parrot
#

yes please, I am stuck in this implementation

maiden peak
#

I meant, try replacing microdeposit with instant and run your code again

inner parrot
#

Response Message : The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.,
getting the same error I tried just now

#

"pm_1QPkamAGbPj5wN7hFEJvZTso"

maiden peak
#

it's still microdeposit

#

did you change your code?

inner parrot
#

getting this error if i change to instant

#

var setupIntentOptions = new SetupIntentCreateOptions
{
Customer = customer.Id,
PaymentMethodTypes = new List<string> { "us_bank_account" },
PaymentMethodOptions = new SetupIntentPaymentMethodOptionsOptions
{
UsBankAccount = new SetupIntentPaymentMethodOptionsUsBankAccountOptions
{
VerificationMethod = "instant",//"instant", //"microdeposits"
FinancialConnections = new SetupIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsOptions
{
Permissions = new List<string> { "payment_method", "balances" },
},
},
},
};
var setupIntentService = new SetupIntentService();
var setupIntentResult = await setupIntentService.CreateAsync(setupIntentOptions);

#

I changed this code

maiden peak
#

would you mind sharing your frontend code?