Php 如何使用Laravel出纳在不立即付款的情况下交换计划和创建发票
Laravel出纳使交换计划变得非常简单:Php 如何使用Laravel出纳在不立即付款的情况下交换计划和创建发票,php,laravel-4,laravel-5,stripe-payments,laravel-cashier,Php,Laravel 4,Laravel 5,Stripe Payments,Laravel Cashier,Laravel出纳使交换计划变得非常简单: $user->subscription('premium') ->swapAndInvoice(); 这项功能也很好,因为它可以立即向用户开具发票,但是,它也可以强制用户立即付款,而不是像通常那样等待一个小时。这似乎妨碍了我的发票。创建webhook是因为一旦swapAndInvoice发生,我似乎无法对发票进行进一步更改 如果我只使用->swap(),它看起来根本不会创建发票,而是创建等待添加到下一张发票的行项目。非常感谢您的
$user->subscription('premium')
->swapAndInvoice();
这项功能也很好,因为它可以立即向用户开具发票,但是,它也可以强制用户立即付款,而不是像通常那样等待一个小时。这似乎妨碍了我的发票。创建webhook是因为一旦swapAndInvoice
发生,我似乎无法对发票进行进一步更改
如果我只使用->swap()
,它看起来根本不会创建发票,而是创建等待添加到下一张发票的行项目。非常感谢您的想法。自从发布这个问题以来,我实际上已经向Laravel出纳存储库提交了一个请求,在StripeGateway.php
文件中添加一个可以执行此类功能的方法
/**
* Invoice the billable entity outside of regular billing cycle without charging the user immediately.
*
* @return bool
*/
public function invoiceWithoutImmediateCharge()
{
try
{
$customer = $this->getStripeCustomer();
// Removed this because it immediately charges the user which doesn't allow the invoice to be modified by webhooks
//Stripe_Invoice::create(['customer' => $customer->id], $this->getStripeKey())->pay();
Stripe_Invoice::create(['customer' => $customer->id], $this->getStripeKey());
return true;
}
catch (\Stripe_InvalidRequestError $e)
{
return false;
}
}
自从发布这个问题以来,我实际上已经向Laravel出纳存储库提交了一个pull请求,以在StripeGateway.php
文件中添加一个可以执行此类功能的方法
/**
* Invoice the billable entity outside of regular billing cycle without charging the user immediately.
*
* @return bool
*/
public function invoiceWithoutImmediateCharge()
{
try
{
$customer = $this->getStripeCustomer();
// Removed this because it immediately charges the user which doesn't allow the invoice to be modified by webhooks
//Stripe_Invoice::create(['customer' => $customer->id], $this->getStripeKey())->pay();
Stripe_Invoice::create(['customer' => $customer->id], $this->getStripeKey());
return true;
}
catch (\Stripe_InvalidRequestError $e)
{
return false;
}
}