简体   繁体   English

如何在客户发票中使用Stripe付款

[英]How to use Stripe payouts with customer invoices

I have a question about how to implement proper payouts for my system/platform. 我对如何为我的系统/平台实施适当的支出有疑问。

Let me explain a little further. 让我进一步解释一下。 I have a platform like Lyft, but instead of creating and issuing charges right after each ride. 我有一个像Lyft这样的平台,但是没有在每次乘车后立即创建和发布费用。 I'm creating invoice items, so that the rider is only charged once every invoice billing cycle(ex. every 2 weeks). 我正在创建发票项目,以便每个发票计费周期(例如,每2周)仅向骑手收取一次费用。 Now, I understand there is no destination id for an invoice or invoice item using Stripe. 现在,我知道使用Stripe的发票或发票项目没有目的地ID。 So I need to tell Stripe somehow what funds need to go to the driver. 因此,我需要以某种方式告诉Stripe,哪些资金需要转给驱动程序。 How do I do that? 我怎么做? It seems like the method would be to create a Stripe payout with the destination as the drivers bank account id. 看来该方法将是创建一个Stripe支付,并以目的地为驾驶员银行帐户ID。 But after attempting this with both the drivers external acount id and the bank account id, Stripe threw an exception saying 'No such external account exists acct_123456ABCD' 但是在尝试使用驱动程序外部帐户ID和银行帐户ID进行此操作后,Stripe抛出了一个异常,说“不存在这样的外部帐户acct_123456ABCD”

Would the method I described above be the correct way to implement this? 我上面描述的方法是否是实现此目的的正确方法? Or is there a better way or more prescribed way? 还是有更好的方法或更规定的方法?

FYI - To understand why I'm creating invoice items, instead of instant charges immediately after a ride, it's because the charges for my service are all very small ($1.00-$3.00), so to avoid a Stripe flat fee of $.30/charge I'm aggregating them into an invoice, where there will be only one flat fee per billing cycle. 仅供参考-为了了解为什么我要创建发票项目,而不是乘车后立即产生即时费用,这是因为我的服务费用都非常小($ 1.00- $ 3.00),因此避免了$ .30 /的Stripe固定费用费用我正在将它们汇总到一张发票​​中,每个计费周期仅收取一笔固定费用。

Thanks for any help. 谢谢你的帮助。

For ex purposes I'll include an example of what I'm doing below. 出于特殊目的,我将在下面提供一个示例。 First I create an invoice item, then I create a payout. 首先,我创建一个发票项目,然后创建一个支出。

            var invoiceItemOptions = new StripeInvoiceItemCreateOptions()
            {
                Amount = tipPricing.GetTotalAmountCharged(),
                Currency = "USD", //defaultCard.CurrencyCode,
                CustomerId = '12334567',

                Metadata = new Dictionary<String, String>() { { "EventId", 123 } }
            };

            var invoiceItemService = new StripeInvoiceItemService();
            StripeInvoiceLineItem invoiceItem = invoiceItemService.Create(invoiceItemOptions);
            StripeResponse invoiceResponse = invoiceItem.StripeResponse;

            ////////////////////////////////////////////////////////////////////////

            var payoutOptions = new StripePayoutCreateOptions()
            {
                Amount = tipPricing.GetTotalDestinationAmount(hasBeenChargedThisMonth), 
                Currency = "USD",
                Destination = bankAccount.ExternalAccountId, //bankAccount.AccountId,
                Metadata = new Dictionary<String, String>() { { "EventId", 123 } }
            };
            var payoutService = new StripePayoutService();
            StripePayout payoutCharge = payoutService.Create(payoutOptions);
            StripeResponse payoutResponse = payoutCharge.StripeResponse;

Payouts are intended to happen on the Connected Account's Balance -> Bank Account, rather than from your Platform to the Connected Account's Bank Account. 付款应在关联帐户的余额->银行帐户上进行,而不是从平台到关联帐户的银行帐户。

You've got at least two choices for funds flows here: 您在这里至少有两种资金流动的选择:

  1. You could run the Invoices (or even a $0 subscription with a two week billing cycle) on your Platform. 您可以在平台上运行发票(甚至$ 0订阅,并需要两个星期的计费周期)。 You could listen for webhooks when invoice.payment_succeeded , then move the funds to the destination connected account using a Transfer , see https://stripe.com/docs/connect/charges-transfers . 你可以监听网络挂接时invoice.payment_succeeded ,然后使用一个移动的资金到目的地连接帐户Transfer ,请参阅https://stripe.com/docs/connect/charges-transfers From the Connected Account's balance it will pay out to their bank account, or you can initiate a Payout (if on manual payouts, https://stripe.com/docs/connect/payouts#using-manual-payouts ) 从关联帐户的余额中,它将支付到他们的银行帐户,或者您可以发起支付(如果是人工支付,则为https://stripe.com/docs/connect/payouts#using-manual-payouts
  2. You could create an Invoice Items / Invoices or a Subscription directly on the Connected Account. 您可以直接在关联帐户上创建发票项目/发票或订阅。 This gets slightly tricker as you will need to remit the fee for your platform, but you can do that with Application Fees, see https://stripe.com/docs/connect/subscriptions#working-with-invoices 这有点棘手,因为您需要汇出平台费用,但是您可以使用“申请费”来做到这一点,请参阅https://stripe.com/docs/connect/subscriptions#working-with-invoices

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

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