Cashier-stripe: Allow quantity of 0 when creating new subscriptions

Created on 15 Jan 2017  路  4Comments  路  Source: laravel/cashier-stripe

Would it be possible to update the buildPayLoad() function in SubscriptionBuilder.php to allow for quantities of 0 to be passed back? Stripe allows for subscriptions with a quantity of 0 to be created.

    /**
     * Build the payload for subscription creation.
     *
     * @return array
     */
    protected function buildPayload()
    {
        return array_filter([
            'plan' => $this->plan,
            'quantity' => $this->quantity,
            'coupon' => $this->coupon,
            'trial_end' => $this->getTrialEndForPayload(),
            'tax_percent' => $this->getTaxPercentageForPayload(),
            'metadata' => $this->metadata,
        ], 'strlen'); // Allows for 0 but not anything else evaluating to false
    }
enhancement

Most helpful comment

Since it's possible to set 0 in the Stripe Dashboard, Cashier should handle it.

All 4 comments

Could really use this too... No movement after over a year and a half? Seems like a relatively straightforward PR, was it rejected?

Subscriptions with a quantity of 0 don't really make sense. Stripe will generate 0 dollar invoices when this happens. It's best to only allow subscriptions with quantities.

Since it's possible to set 0 in the Stripe Dashboard, Cashier should handle it.

I'm gonna revisit this soon after talking to Stripe directly about this.

Was this page helpful?
0 / 5 - 0 ratings