Friday, June 5, 2015

Easy way to transfer payment from one account to another using STRIPE in php

Transfer payment from one account to another using STRIPE:

This is done by the following way:
1. Deduct the amount from customer using main account of Stripe.
2. Add amount to the merchant using the same main Stripe account.
For this you will be in need of a Stripe testing/working account.
Firstly Register yourself at Stripe.com
and add stripe in your project it will generate a key & configure it in your account
Then Deduct money from any account using this

Stripe_Charge::create(array(
  "amount" => 600,
  "currency" => "usd",
   "card" => array(
    "number" => "4242424242424242",
    "exp_month" => 10,
    "exp_year" => 2015,
    "cvc" => "314"
  ),
  "metadata" => array("order_id" => "6735")
));

It will deduct $6 using this card and will be add to Stripe Account.
Now pay amount to merchant account using this
            $bank_acc = Stripe_Token::create(array( "bank_account" => array( "country" => "US", "routing_number" => "bank_routing_number", "account_number" => "bank_account_no" ) ));
            $recipient = Stripe_Recipient::create(array( "name" => "name", "type" => "individual", "bank_account"=>$bank_acc->id ));
            $payment =  Stripe_Transfer::create(array( "amount" => '600', "currency" => "usd", "recipient" => $recipient->id, "description" => "Transfer for test@example.com" ));
It will add $6 to merchant account.

Thanks

No comments:

Post a Comment