简体   繁体   English

条纹-手动付款

[英]Stripe - Manual payout

In my application i'm holding some amount in user's custom account for a specific reason by setting "Payout schedule" as "Manual". 在我的应用程序中,出于特定原因,我将“付款时间表”设置为“手动”,从而在用户的自定义帐户中保留了一些金额。 This lets me hold the payout in custom acccount to a maximum of 90 days. 这使我可以将自定义帐户中的付款最多保留90天。 And a user can realease the payment to the external account in certain scenerios even before 90 days. 用户甚至可以在90天之前在某些场景中将付款重新分配给外部帐户。

Now my Question is, As Stripe takes 2 to 7 days in rolling out the payment so i can only release the payment after the processing gets completed. 现在我的问题是,由于Stripe需要花2到7天的时间来发放付款,因此我只能在处理完成后才下达付款。

How May i get to know about that? 我该如何得知? How would i know if the tranactions is in pending state and then How to know if it gets available for payout in bank account? 我如何知道交易是否处于待处理状态,然后如何知道该交易是否可用于银行帐户中的付款? Is there any way to achieve it? 有什么办法可以实现? Please let me know as im new to stripe. 请让我知道我是条纹新手。 Any help would be highly appreciated. 任何帮助将不胜感激。

Are you talking about Auth and Capture? 您是在谈论Auth and Capture吗? Auth is when you make sure that the user's bank ALLOWS the user to make the transaction. 当您确定用户的银行允许该用户进行交易时,即为Auth。 Then, once the payment is Authorized, you then capture it, and the funds are transferred to Stripe. 然后,在付款被授权后,您就可以将其捕获,资金将转移到Stripe。

Example: You are selling a service, such as Web Development, for $5000. 示例:您以$ 5000的价格出售一项服务,例如Web Development。 You want to make sure that the person has the money first. 您要确保该人先拥有钱。 You also want to make sure that the person who has the money doesn't spend it while you are rendering your service for them. 您还希望确保有钱的人在为他们提供服务时不要花钱。

The way you would go about this is to: 您将执行以下操作的方法是:

  1. Auth the payment through Stripe. 通过Stripe验证付款。 You Auth the payment, and it goes into Pending in the person's bank account (they don't have access to spend that money any longer). 您对付款进行身份验证,付款就会进入该人的银行帐户中的待处理状态(他们将无权再使用该笔钱)。
  2. Render your service 呈现您的服务
  3. Capture the payment. 捕获付款。 The money is deducted from their account and added to your Stripe account. 这笔钱将从他们的帐户中扣除,并添加到您的Stripe帐户中。

The way through Stripe's API to do this is: Auth 通过Stripe API进行此操作的方法是:Auth

// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");

// Token is created using Checkout or Elements!
// Get the payment token ID submitted by the form:
$token = $_POST['stripeToken'];

// Charge the user's card:
$charge = \Stripe\Charge::create(array(
  "amount" => 999,
  "currency" => "usd",
  "description" => "Example charge",
  "capture" => false,
  "source" => $token,
));

Render your service... Then Capture 呈现您的服务...然后捕获

// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");

$charge = \Stripe\Charge::retrieve("ch_1A9eP02eZvKYlo2CkibleoVM");
$charge->capture();

When you create the charge it will return an ID in the JSON results and whether or not it's been captured. 创建费用时,它将在JSON结果中返回一个ID,以及是否已捕获该ID。 If you want to check up to see if the Auth was successful, first save the ID in the response to the charge... The response will look something like this... 如果您要检查以查看验证是否成功,请先将ID保存在收费响应中。响应将类似于以下内容...

Stripe\Charge JSON: {
  "id": "ch_1CCjK02eZvKYlo2C85c1GGmL",
  "object": "charge",
  "amount": 2000,
  "amount_refunded": 0,
  "application": null,
  "application_fee": null,
  "balance_transaction": "txn_19XJJ02eZvKYlo2ClwuJ1rbA",
  "captured": false,
  ......... more ........

}, },

To check on the charge, to see if it has been Authorized, you can do something like this... 要检查费用,看看它是否已被授权,您可以执行以下操作...

\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
\Stripe\Charge::retrieve("ch_1CCjK02eZvKYlo2C85c1GGmL");

And the response will be something like ... 响应将类似于...

Stripe\Charge JSON: {
  "id": "ch_1CCjK02eZvKYlo2C85c1GGmL",
  "object": "charge",
  "amount": 2000,
  "amount_refunded": 0,
  "application": null,
  "application_fee": null,
  "balance_transaction": "txn_19XJJ02eZvKYlo2ClwuJ1rbA",
  "captured": true,
  "created": 1522739568,
    ....more....
  "outcome": {
      "network_status": "approved_by_network",
      "reason": null,
      "risk_level": "normal",
      "seller_message": "Payment complete.",
      "type": "authorized" // AUTHORIZED

Then you charge. 然后,您收费。 Done. 完成。

https://stripe.com/docs/charges https://stripe.com/docs/charges

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

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