ACH Bank Transfer verify and successful in Laravel

ACH Bank

In the Previous tutorial, I explained client-side validation in using stripe js but today I will explain how to money transfer user account to owner account with ACH bank and verify.

Stripe manually collecting the amount and update it. You can read the document from this link ACH Guide.

Step 1: Create a Controller

Create a Controller and put the below code:


namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use Session;
use Exception;
use App\Payment;
use Stripe\Charge;
use Stripe\Stripe;
use Stripe\Customer as StripeCustomer;
use Stripe\Transfer;
use Stripe\Source;

class ACHBankController extends Controller{
    public function achBank(Request $request){
        $amount = 1000;        
        $currency   = 'usd';
        if (empty(request()->get('stripebankToken'))) {
            session()->flash('error', 'Some error while making the payment. Please try again');
            return back()->withInput();
        try {
            /** Add customer to stripe, Stripe customer */
            $customerBank = StripeCustomer::create([
                'source'    => request('stripebankToken'),
                'name'      => Auth::guard('customer')->user()->name,
                'email'      => Auth::guard('customer')->user()->email,
        }catch (Exception $e) {
            $apiError = $e->getMessage();
        if (empty($apiError) && $customerBank) {
            try {
                $bank_account = \Stripe\Customer::retrieveSource(
                $verify = $bank_account->verify(['amounts' => [32, 45]]);
                $charge = Charge::create(array(
                    'customer'      => $verify->customer,
                    'amount'        => $amount,
                    'currency'      => $currency,
                    'description'   => 'This is Payment Transfer',
            } catch (Exception $e) {
                $apiError = $e->getMessage();
        if (empty($apiError) && $charge) {
            $paymentDetails = $charge->jsonSerialize();
        } else {
            session()->flash('error', 'Error in capturing amount: ' . $apiError);
            return redirect()->back();

You can Create a blade file, create a form and put it in HTML Code (Explain Previous Tutorial) and create also route so you can show your results. Please create a Testing API key from the Stripe for demo test.

About Dhaval Shah

My name is Dhaval Shah. I'm a Laravel developer. I live in India and I love to write tutorials and tips that can help other developers. I am a big fan of PHP, Java-script, JQuery, Laravel, WordPress, and Bootstrap.
Follow me on Github / Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!