#stephy

1 messages · Page 1 of 1 (latest)

eager wingBOT
elfin tinsel
#

Hi

weak sonnet
#

Hello! What's your question?

elfin tinsel
#

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?

weak sonnet
#

They're very different - generally though, I'd recommend you do ACH direct debit since that works with PaymentIntents and Payment Element

elfin tinsel
#

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?

weak sonnet
#

What do you mean by reduce other charges?

elfin tinsel
weak sonnet
#

Let's actually back up here for a minute - how are you currently integrating with payments with STripe?

elfin tinsel
#

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?

weak sonnet
#

So you haven't integrated with STripe at all yet?

elfin tinsel
#

Not at all...we are from India so here these ach payment is not supported

#

But we integrated stripe card payment

weak sonnet
#

Gotcha - so how did you integrate with cards? Did you use the payment element?

elfin tinsel
#

In cards actually integrated some one else in my team ..when am refer the code they do paymentIntent using

weak sonnet
#

Got it - then you'll want to use ACH debit. ACH credit doesn't work with payment intents

elfin tinsel
#

Both are same right?

#

If am using this ach debit then how can I integrate this in my website?

weak sonnet
#

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

elfin tinsel
#

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?

weak sonnet
#

You're using the bank account numbers directly?

#

Then you're missing all the code you need to verify the bank accounts with microdeposits

elfin tinsel
elfin tinsel
weak sonnet
#

We talk about how to do all of this there

elfin tinsel
#

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

weak sonnet
#

The transaction won't be successful until you've actually verified the bank account with microdeposits

elfin tinsel
#

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

weak sonnet
#

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

eager wingBOT
elfin tinsel
#

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

weak sonnet
#

Please don't just dump all your code here

elfin tinsel
#

Is this would work?

weak sonnet
#

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

elfin tinsel
#

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?

scenic zodiac
scenic zodiac
elfin tinsel