#Amer Bearat

1 messages · Page 1 of 1 (latest)

idle patioBOT
verbal turtle
severe lion
#

@verbal turtle req_cg5MhX2EJbaFYv

flat raven
#

👋 Taking over this thread! Looking into it now

severe lion
#

ok this is what inside the body amounts=[100,0]

flat raven
#

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

GitHub

Java library for the Stripe API. . Contribute to stripe/stripe-java development by creating an account on GitHub.

severe lion
#

// 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

flat raven
#

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.

severe lion
#

@flat raven i added this line now im getting this 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

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

severe lion
#

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

flat raven
#

does should be like this "amounts": [32,45]
Yup!

severe lion
#

@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

#

@flat raven i updated the error message

flat raven
#

I'm not familiar with Apex. I'd recommend googling how to set value as array in Apex

severe lion
#

i just sent this "amounts":[32,4]

flat raven
#

This was the initial error that you faced without setting the request body as application/x-www-form-urlencoded

severe lion
#

i do still have this in

flat raven
#

I think you got to revert to the code with this state and fix the request body

severe lion
#

@flat raven now im getting this error

flat raven
severe lion
#

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

flat raven
#

This request has passed the request validation. Let me take a look at why the bank_account_verification_failed

severe lion
#

okay

flat raven
severe lion
#

you mean to use payment intent instead of a charge

#

Also, i created this charge req_XLtnEyeyXIsFZd why status is pending @flat raven

flat raven
#

you mean to use payment intent instead of a charge
Yes! Payment Intent uses new version ACH direct debit

severe lion
#

okay, do you know why charge req_XLtnEyeyXIsFZd status is stuck in pending

#

@flat raven ^

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

severe lion
#

if i use payment intent will still be the same wait time? @flat raven

#

payment intents vs charge object

flat raven
severe lion
#

okay thank you so much

flat raven
#

No problem! Happy to help 😄