Error when total amount is zero

Hi Tim,

I installed the Stripe Checkout addon for my payments. Works like a charm!
The only thing is I get an error message 'The line-items parameter is required in payment mode' if I have an item in the basket which is free (so there is nothing to be paid).
I've tried to look for a solution, but I'm probably overlooking things. Can you help me out please?

Kind regards from the Netherlands,
Jeroen Stoutjesdijk

tim

Ok you would need to produce a workaround like we do for negative amounts.

Try changing:

      // Workaround as Stripe does not support negative values, or partial quantities.
        foreach ($request['line_items'] as $item) {
          if ($item['amount'] < 0 || round($item['quantity']) != $item['quantity']) {

to

      // Workaround as Stripe does not support zero, negative values, or partial quantities.
        foreach ($request['line_items'] as $item) {
          if ($item['amount'] <= 0 || round($item['quantity']) != $item['quantity']) {

Turning < into <= is the difference.

Se kod på GitHub