PHP Stripe API ACH Payments using stripe.js

PHP Stripe API ACH Payments using stripe.js

In this Post We Will Explain About is PHP Stripe API ACH Payments using stripe.js With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Payment Methods: ACH payments via StripeExample

In this post we will show you Best way to implement Stripe now supports ACH payments, hear for Accepting ACH Payments with Stripe using PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

HTML PART

ACH payments are electronic payments simple net banking that are created small amount when the customer gives an originating simple institution as well as corporation, or other customer or any (originator) simple authorization to debit card directly from the main customer’s secure with tetsing and checking or saving his account for the purpose of simple bill payment.

Read Also:  CodeIgniter Stripe Payment Gateway Api Integration

Here can show to simple create simple ach accounts with verification of micro deposits Two small funds.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Live Example Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bootstrap.min.css">
  <script src="jquery.min.js"></script>
  <script src="bootstrap.min.js"></script>
</head>
<body>

<div class="container">
<?php
if(isset($_REQUEST['msg']))
{
?>
<div class="alert alert-success">
			<strong>Success!</strong>		
		<?php
		echo $_REQUEST['msg'];
		?>
</div>  
<?php
}
?>

<?php
if(!isset($_REQUEST['msg']))
{
?>
  <h2>ACCOUNT VERIFICATION FORM</h2>
  <form action="" method="POST">
    <div class="form-group">
      <label for="account_holder_name">ACCOUNT HOLDER NAME:</label>
      <input type="text" class="form-control" id="account_holder_name" placeholder="ENTER ACCOUNT HOLDER NAME" name="account_holder_name" required>
    </div>
	 <div class="form-group">
      <label for="account_holder_type">ACCOUNT HOLDER TYPE:</label>
      <input type="text" class="form-control" id="account_holder_type" placeholder="ENTER ACCOUNT HOLDER TYPE" name="account_holder_type" required>
    </div>
    <div class="form-group">
      <label for="routing_number">ROUTING NUMBER:</label>
      <input type="text" class="form-control" id="routing_number" placeholder="ENTER ROUTING NUMBER" name="routing_number" required>
    </div>
	<div class="form-group">
      <label for="account_number">ACCOUNT NUMBER:</label>
      <input type="text" class="form-control" id="account_number" placeholder="ENTER ACCOUNT NUMBER" name="account_number" required>
    </div>
    <button type="submit" class="btn btn-success" name="verify_form">Submit</button>
  </form>
<?php
}
else
{
	?>
		  <h2>ACCOUNT VERIFICATION FORM</h2>
		  <form action="" method="POST">
			<div class="form-group">
			  <label for="ammount1">AMMOUNT 1:</label>
			  <input type="text" class="form-control" id="ammount1" placeholder="ENTER AMMOUNT 1" name="ammount1" required>
			</div>
			 <div class="form-group">
			  <label for="ammount2">AMMOUNT 2:</label>
			  <input type="text" class="form-control" id="ammount2" placeholder="ENTER AMMOUNT 2" name="ammount2" required>
			</div>
			<button type="submit" class="btn btn-success" name="verify_amount">Submit</button>
		  </form>
	
	<?php
}
?>

</div>

</body>
</html>

PHP PART

<?php 
require_once('config.php');

	if(isset($_POST['verify_amount']))
	{
		$ammount1 = $_POST['ammount1'];
		$ammount2 = $_POST['ammount2'];
		$customer = \Stripe\Customer::retrieve($_SESSION['custid']);
		$bank_account = $customer->sources->retrieve($_SESSION['bankaccid']);
		$bank_account->verify(array('amounts' => array($ammount1, $ammount2)));
		if($bank_account)
		{
			header('location: create.php?msg=Your Bank Account has been verify successfully!');
		}

	}

	if(isset($_POST['verify_form']))
	{
		$account_holder_name = $account_holder_type = $routing_number = $account_number = '';
		$account_holder_name = $_POST['account_holder_name'];
		$account_holder_type = $_POST['account_holder_type'];
		$routing_number = $_POST['routing_number'];
		$account_number = $_POST['account_number'];
		

		
			try {
				
						$bank_token = \Stripe\Token::create(array(
						  "bank_account" => array(
							"country" => "US",
							"currency" => "USD",
							"account_holder_name" => $account_holder_name,
							"account_holder_type" => $account_holder_type,
							"routing_number" => $routing_number,
							"account_number" => $account_number
						  )
						));
						
					$b_token = $bank_token->__toJSON();
					$obj_token = json_decode($b_token, TRUE);
					
					$b_tok = $obj_token['id'];
					$bank_account_id = $obj_token['bank_account']['id'];
					$_SESSION['bankaccid'] = $bank_account_id;
					
					$sp = \Stripe\Customer::create(array(
					  "source" => $b_tok,
					  "description" => $account_holder_name
					));
					
					$customer_json = $sp->__toJSON();
					$obj = json_decode($customer_json, TRUE);
					$cust_id =  $obj['id'];
					
					$_SESSION['custid'] = $cust_id;
					if($sp)
					{
						header('location: create.php?msg=We have diposited two Microammount into your Bank Account.');
					}				
			} catch(\Stripe\Error\Card $e) {
			} catch (\Stripe\Error\RateLimit $e) {
			} catch (\Stripe\Error\InvalidRequest $e) {
			} catch (\Stripe\Error\Authentication $e) {
			} catch (\Stripe\Error\ApiConnection $e) {
			} catch (Exception $e) {
			}
	}

?>

Example

I hope you have Got What is PHP Stripe API ACH Payments using stripe.js And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.