简体   繁体   English

使用Stripe Payout API将金额转入客户的银行帐户

[英]Transfer amount into customer's bank account using Stripe Payout API

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 . 我正在为移动应用程序开发REST API的实现,该应用程序封装了以使用Stripe作为支付网关的点数相当于兑换积分的功能。 To accomplish it I have used Stripe payout API to transfer amount directly into destination bank account. 为了实现这一点,我使用Stripe支付API将金额直接转入目标银行账户。

Following is code snippet of call to payout API of Stripe 以下是调用Stripe支付API的代码片段

$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 执行上面的代码片段后,我收到错误消息,作为对payout API调用的响应

The bank account ba_1CIZEOCHXaXPEwZByNehIJrY is not attached to this Stripe account. 银行帐户ba_1CIZEOCHXaXPEwZByNehIJrY未附加到此Stripe帐户。 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. 请建议我一个合适的解决方案。

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. 实际上,您可以使用Stripe支付API向已连接的Stripe帐户的银行帐户或借记卡发起付款。但是,您可以创建转帐,将资金从您的Stripe帐户发送到已连接的帐户。

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

Below is the php code : 下面是php代码:

\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. 我还搜索了条纹文档,直接转账到第三方卡/银行账户,但没有找到任何东西。

With Stripe Connect, you can make API requests on behalf of connected accounts using the Stripe-Account header as documented here . 随着条纹连接,可以使代表使用连接帐户的API请求Stripe-Account头作为记录在这里 This applies to any API requests from creating a Charge or a Payout to listing all Refunds. 这适用于从创建费用或付款到列出所有退款的任何API请求。

This obviously assumes that you use Stripe Connect and that the person receiving funds from you has their own connected accounts. 这显然假设您使用Stripe Connect,并且从您那里获得资金的人拥有自己的关联帐户。 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. 这显然假设您熟悉Stripe Connect并且正在积极使用它。 It would be the only way to handle this and you can read more about this feature here . 这将是处理此问题的唯一方法,您可以在此处阅读有关此功能的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM