#stephy
1 messages · Page 1 of 1 (latest)
Hi
Hello! What's your question?
Actually I have to integrate ach payment in my website..so which one is better
.like I saw 2 kind of ACH payment,ach direct debit and ach credit transfer?
They're very different - generally though, I'd recommend you do ACH direct debit since that works with PaymentIntents and Payment Element
The think that I understand ,ach payment method used to recieve the money from customer bank to our stripe account ..so we can reduce other charges right?
What do you mean by reduce other charges?
Ok for that if am doing it in my website then what is procees?
Let's actually back up here for a minute - how are you currently integrating with payments with STripe?
Now am not started ach payments section...so really confused how start ? And where I start?
After reading documention ,the think I understand money is debit from customer account and tranfer to the vendor or admin stripe account? So I have doubt that how can we debit the money from customer bank account like that?
How to customise this?
So you haven't integrated with STripe at all yet?
Not at all...we are from India so here these ach payment is not supported
But we integrated stripe card payment
Gotcha - so how did you integrate with cards? Did you use the payment element?
In cards actually integrated some one else in my team ..when am refer the code they do paymentIntent using
Got it - then you'll want to use ACH debit. ACH credit doesn't work with payment intents
Both are same right?
If am using this ach debit then how can I integrate this in my website?
No, ACH debit and ACH credit are not the same
And I'd recommend pausing here - you need to talk to the person that integrated cards and understand how they implemented it
If they're using Payment Element then you can reuse a lot of that to also accept ACH debit
But in ach payment we are using account and route number instead of card number so ..If I just need to give that only
use Illuminate\Http\Request;
use Stripe\Stripe;
use Stripe\Customer;
use Stripe\PaymentIntent;
Route::post('/process-ach-payment', function (Request $request) {
// Step 4: Collect the required ACH payment information from the form submission
$accountNumber = $request->input('accountNumber');
$routingNumber = $request->input('routingNumber');
$amount = $request->input('amount');
// Step 5: Set up Stripe with your API credentials
Stripe::setApiKey('YOUR_STRIPE_API_KEY');
// Step 6: Create a customer or retrieve an existing one from Stripe
$customer = Customer::create([
'source' => [
'object' => 'bank_account',
'account_number' => $accountNumber,
'routing_number' => $routingNumber,
'account_holder_name' => 'Customer Name',
'account_holder_type' => 'individual',
],
]);
// Step 7: Create a PaymentIntent to charge the customer
$paymentIntent = PaymentIntent::create([
'amount' => $amount,
'currency' => 'usd',
'customer' => $customer->id,
'payment_method_types' => ['ach_debit'],
]);
// Step 8: Handle the PaymentIntent response and redirect the user
if ($paymentIntent->status === 'succeeded') {
// Payment succeeded, redirect the user to a success page
return redirect('/success');
} else {
// Payment failed, redirect the user to an error page
return redirect('/error');
}
});
I got a code like this..is this ok or anything that I missed?
You're using the bank account numbers directly?
Then you're missing all the code you need to verify the bank accounts with microdeposits
When I search I get code like this... So actually I want like the customer would enter their bank account number and routing number to.tranfer amount
How this do ? If am in testing mode then the verification is possible?
Have you read through the full docs on this? https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web&ui=API
We talk about how to do all of this there
I should follow this steps ....thank you...again one doubt I'd am testing then I entered the account number and routing number they you give in test data..if the transaction would be successful???
The transaction won't be successful until you've actually verified the bank account with microdeposits
Ok I will verify with micro deposit then it would be success right?
And you tell me ach credit transfer and debit are different? What is the difference actually? And you suggest me to do ach debit that why? When you suggest me to do direct debit then I thought both are same purpose
If you've followed the guide and used the right testing info then yes, it should work
ACH credit and debit have different flows of funds (with ACH credit the customer is initiating sending the funds to you, whereas ACH debit you're pulling the funds)
integration-wise a big difference is that ACH credit isn't supported with Payment Intents
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Stripe\Stripe;
use Stripe\Charge;
class PaymentController extends Controller
{
public function showCheckoutForm()
{
return view('checkout');
}
public function processPayment(Request $request)
{
Stripe::setApiKey(config('services.stripe.secret'));
$amount = 1000; // Payment amount in cents
$token = $request->input('stripeToken');
try {
$charge = Charge::create([
'amount' => $amount,
'currency' => 'usd',
'source' => $token,
'description' => 'ACH Direct Debit Payment'
]);
// Process the successful payment
// You can update your database or perform any necessary actions here
return redirect('/success')->with('success', 'Payment completed successfully!');
} catch (\Exception $e) {
// Handle payment failure
return redirect('/failure')->with('error', $e->getMessage());
}
}
}
<!-- Add the Stripe JavaScript library -->
<script src="https://js.stripe.com/v3/"></script>
<!-- Payment form -->
<form action="/process-payment" method="POST">
@csrf
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="{{ config('services.stripe.key') }}"
data-amount="1000" // Payment amount in cents
data-name="ACH Direct Debit Payment"
data-description="Payment Description"
data-locale="auto"
data-currency="usd"
data-email="{{ auth()->user()->email }}" // Optionally pre-fill the customer's email
>
</script>
</form>
Please don't just dump all your code here
Is this would work?
Instead of asking us if this will work you should be testing this out on your end and asking us specific questions if you run into errors/bugs
We can't just spot check code and know if it'll work from looking at it - it's much better to confirm through testing
Oh sorry
I just wanted to know If using this checkout js then all the codes of payment intent and averything will be there or need to do it in my server side code also?
It looks like you might have been following an older integration guide, because using the Charges API is no longer recommended, and that snippet with checkout.js is a legacy integration we also advise not to use.
Current ACH payment guide: https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web&ui=API
Legacy Checkout migration docs: https://stripe.com/docs/payments/checkout/migration
No, this is not a complete integration using recommended patterns.
I'd urge you to review the docs above to see our current recommendations.
Ok I will follow the above 2 doc