#Amer Bearat
1 messages · Page 1 of 1 (latest)
Hi, can you share the request id where you're seeing this error? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
@verbal turtle req_cg5MhX2EJbaFYv
👋 Taking over this thread! Looking into it now
ok this is what inside the body amounts=[100,0]
It looks like you're constructing Stripe requests on your own. Could you share the full code on you construct request and set to the endpoint? From the request log, it showed that the request body is empty?
In addition, I'd recommend using Stripe Java library, so that it handles all the API call to Stripe: https://github.com/stripe/stripe-java
Example of verifying customer source with Stripe Java library:
https://stripe.com/docs/api/customer_bank_accounts/verify?lang=java
// Define the request body for verifying the bank account
List<Integer> amounts = new List<Integer>{ 32, 45 };
String body = 'amounts=' + JSON.serialize(amounts);
HttpRequest verifyBankAccountRequest = new HttpRequest();
verifyBankAccountRequest.setEndpoint('https://api.stripe.com/v1/customers/' + customerId + '/sources/' + bank_accounId + '/verify');
verifyBankAccountRequest.setHeader('Authorization', 'Bearer ' + STRIPE_SECRET_KEY);
verifyBankAccountRequest.setMethod('POST');
verifyBankAccountRequest.setBody(body);
HttpResponse verifyBankAccountResponse = new Http().send(verifyBankAccountRequest);
@flat raven i can not use library , we are building the integration inside salesforce
Im making http rest api call out as mentioned on this link https://stripe.com/docs/api/customer_bank_accounts/verify
Thanks for sharing! Stripe uses form-encoded request bodies. Based on your request, it's likely that the request body isn't correct set with application/x-www-form-urlencoded format.
@flat raven i added this line now im getting this error
"error": {
"message": "Invalid array",
"param": "amounts",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_57NyInoftcXcLv?t=1676596952",
"type": "invalid_request_error"
}
again this is the body im sending amounts=[32,45]
i added this line verifyBankAccountRequest.setHeader('Content-Type', 'application/x-www-form-urlencoded')
Sorry i been working on this all day and its not working for me @flat raven
That's a good progress! I can see the request body with amount coming, so setting request content as 'application/x-www-form-urlencoded' is working
The next problem here is that amount value was set as string in the request. It should be set as array instead
this was showing i been sending "amounts": "[32,45]"
does should be like this "amounts": [32,45]
can you write the right format @flat raven
does should be like this "amounts": [32,45]
Yup!
can you write the right format
I'm too sure how the array can be written in HttpRequest. Perhaps you can try it out with some references here: https://metamug.com/article/java/java-11-post-request-url-encoded.html
@flat raven im using language called apex similar to java. Salesforce only support Apex
okay i just sent this "amounts":[32,4] is not taking it
i got this error
"error": {
"message": "You must provide the 'amounts' parameter as an array of two integers.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_J6RtUwMAwiMWv5?t=1676598169",
"type": "invalid_request_error"
}
}
@flat raven i updated the error message
I'm not familiar with Apex. I'd recommend googling how to set value as array in Apex
i just sent this "amounts":[32,4]
In https://dashboard.stripe.com/test/logs/req_J6RtUwMAwiMWv5, the request body is empty
This was the initial error that you faced without setting the request body as application/x-www-form-urlencoded
i do still have this in
The previous request https://dashboard.stripe.com/test/logs/req_57NyInoftcXcLv was able to set amounts in the request body, but the only issue was with the value being in incorrect format
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I think you got to revert to the code with this state and fix the request body
@flat raven now im getting this error
"error": {
"code": "bank_account_verification_failed",
"doc_url": "https://stripe.com/docs/error-codes/bank-account-verification-failed",
"message": "The amounts provided do not match the amounts that were sent to the bank account.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_blVZzunV0HRbFx?t=1676598745",
"type": "invalid_request_error"
}
Awesome! The request was sent correctly in https://dashboard.stripe.com/test/logs/req_blVZzunV0HRbFx
what im doing create a bank account token. then create customer with bank account token id and then verifyBankAccoun using rest api
@flat raven yup thank you
This request has passed the request validation. Let me take a look at why the bank_account_verification_failed
okay
To test successful bank verification, the amounts should be [32, 45]: https://stripe.com/docs/ach-deprecated#testing-ach
The amounts set in https://dashboard.stripe.com/test/logs/req_blVZzunV0HRbFx was [32, 4]
I'd also like to remind that the flow you're using is legacy and deprecated ACH direct debit flow.
It's recommended to use new ACH direct debit flow instead: https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web&ui=API
you mean to use payment intent instead of a charge
Also, i created this charge req_XLtnEyeyXIsFZd why status is pending @flat raven
you mean to use payment intent instead of a charge
Yes! Payment Intent uses new version ACH direct debit
okay, do you know why charge req_XLtnEyeyXIsFZd status is stuck in pending
@flat raven ^
This is expected as:
ACH payments take up to 5 business days to receive acknowledgment of their success or failure:
- When created, ACH charges have the initial status of pending.
- A pending balance transaction is immediately created reflecting the payment amount, less our fee.
- Payments created on or after 22:00 UTC are currently processed on the next business day.
- During the following 4 business days, the payment transitions to either succeeded or failed depending on the customer’s bank.
- Successful ACH payments are reflected in your Stripe available balance after 7 business days, at which point the funds are available for automatic or manual transfer to your bank account.
- Failed ACH payments reverse the pending balance transaction created.
- Your customer sees the payment reflected on their bank statement 1-2 days after creating the charge. (Your customer knows if the payment succeeds before the bank notifies Stripe.)
From https://stripe.com/docs/ach-deprecated#ach-payments-workflow
It will take some time to process ACH direct debit transactions
if i use payment intent will still be the same wait time? @flat raven
payment intents vs charge object
Payment Intent has shorter processing time:
ACH Direct Debit is a delayed notification payment method. This means that it can take up to four business days to receive notification of the success or failure of a payment after you initiate a debit from your customer’s account.
okay thank you so much
No problem! Happy to help 😄