5

I am working on an implementation of REST API for a mobile application which encapsulates feature of redemption of earned points in form of money equivalent to points using Stripe as a payment gateway . To accomplish it I have used Stripe payout API to transfer amount directly into destination bank account.

Following is code snippet of call to payout API of Stripe

$payout=\Stripe\Payout::create(array(
  "amount" => 400,
  "currency" => "usd",
  "destination"=>$ID,/* ID of customer bank account ba_1CIZEOCHXaXPEwZByNehIJrY  */
  "source_type"=>'bank_account'
));

Upon execution of above code snippet I receive error message as response to call of payout API

The bank account ba_1CIZEOCHXaXPEwZByNehIJrY is not attached to this Stripe account. External accounts can only be attached to Standard accounts via the dashboard.

According to above error message it seems that same bank account needs to be attached to both customer and connected stripe account but I am unable to find appropriate solution to attach customer's bank account to merchant as an external account.

Please suggest me an appropriate solution to it.

Rubin Porwal
  • 3,736
  • 1
  • 23
  • 26
  • Since you want to send Payout to multiple accounts, I think you should look into custom accounts. [this](https://stripe.com/docs/connect/payouts) may help. – jagad89 Apr 19 '18 at 12:48
  • @jagad89 Thank you But as you can note that I had used same code snippet according to examples mentioned into link which you had shared – Rubin Porwal Apr 19 '18 at 13:56

2 Answers2

4

Actually you can use the Stripe payout API to initiate a payout to either a bank account or debit card of a connected Stripe account.However you can create a transfer , To send funds from your Stripe account to a connected account.

https://stripe.com/docs/api/transfers/create

Below is the php code :

\Stripe\Stripe::setApiKey("sk_test_AjtBCFvy8Ah0x5vLmd5Ntemi");

\Stripe\Transfer::create([
  "amount" => 400,
  "currency" => "usd",
  "destination" => "acct_1CPuerJ18us5u9z6",
  "transfer_group" => "ORDER_95"
]);

I have also searched stripe documentation , to directly transfer the payment in the third party card / bank account, but did not find anything.

Manoj Agrawal
  • 429
  • 3
  • 10
  • but I want to have `acct_1CPuerJ18us5u9z6` Manoj Agrawal how to have this? If I want to transfere Stripe account to different bank account? – Aneri Vala Jan 06 '20 at 13:08
  • @Aneri Vala This is connected stripe account id , if the stripe account is already connected , you can find it in the stripe connect. If you do not have any connected account then first you have to connect. You can find the more details in this link https://stripe.com/docs/connect/authentication – Manoj Agrawal Mar 09 '20 at 17:31
-2

With Stripe Connect, you can make API requests on behalf of connected accounts using the Stripe-Account header as documented here. This applies to any API requests from creating a Charge or a Payout to listing all Refunds.

This obviously assumes that you use Stripe Connect and that the person receiving funds from you has their own connected accounts. You also have to use Custom or Express accounts if you want to be able to control their Payouts. This is not allowed with Standard accounts.

The code would look like this:

$payout=\Stripe\Payout::create(array(
  "amount" => 400,
  "currency" => "usd",
  "destination"=> "ba_XXXX" // bank account id
),
array(
  "stripe_account" => "acct_XXXX" // id of the connected account
));

This obviously assumes that you are familiar with Stripe Connect and are actively using it. It would be the only way to handle this and you can read more about this feature here.

koopajah
  • 23,792
  • 9
  • 78
  • 104
  • I had tried executing above code snippet but it generates an error message "No such external account: ba_1CIZEOCHXaXPEwZByNehIJrY" – Rubin Porwal Apr 19 '18 at 15:47
  • Yes because you are likely passing incorrect ids. This is beyond a coding issue though and more likely a misunderstanding of Stripe Connect's features so I'd recommend talking to Stripe's support team: https://support.stripe.com/email – koopajah Apr 19 '18 at 16:07
  • @RubinPorwal "No such external account: ba_1CIZEOCHXaXPEwZByNehIJrY" such thing also happen when you created account with test credentials and trying to payout using live credentials, or vice versa. – jagad89 Apr 20 '18 at 06:56
  • This code snippet transfers funds from one stripe account to another stripe account, and not to a bank. That is why you get 'No such external account' message when you try to send money to a bank account, 'ba_1CIZEOCHXaXPEwZByNehIJrY' – Bennet Joseph Oct 26 '19 at 11:04