Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用Laravel出纳在不立即付款的情况下交换计划和创建发票_Php_Laravel 4_Laravel 5_Stripe Payments_Laravel Cashier - Fatal编程技术网

Php 如何使用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(),它看起来根本不会创建发票,而是创建等待添加到下一张发票的行项目。非常感谢您的

Laravel出纳使交换计划变得非常简单:

$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;
    }
}