#siddarth_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
๐ happy to help
the SetupIntent still needs authorization
basically it's in a requires_action state
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
you have chosen to verify the ACH DD with microdeposits (ie verification_method: "microdeposits",)
so you need to follow these steps https://docs.stripe.com/payments/ach-direct-debit/set-up-payment?platform=web&payment-ui=direct-api#web-verify-with-microdeposits
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
you just need to replace verification_method: "microdeposits" with verification_method: "instatnt"
if i use verification_method: "instatnt" do I need to make any code change then?
I'm not sure what's your code, but I would first try that and see what happens
yes please, I am stuck in this implementation
I meant, try replacing microdeposit with instant and run your code again
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"
it's still microdeposit
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
did you change your code?
getting this error if i change to instant
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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
would you mind sharing your frontend code?