Stripe: Use Coupons with price_id in Checkout

Viewed 105

I have a Price and a Coupon setup in Stripe. I have tried to create both a 100% off Coupon (% based) or a 10 euro off Coupon (fixed amount).

I create a Checkout session using:

stripe.checkout.Session.create(
        success_url="https://www.google.com",
        cancel_url="https://www.google.com",

        payment_method_types=["card", "ideal"],
        line_items=[
            {
                "price": "price_12344",
                "quantity": 1
            }
        ],
        mode="payment",
        customer=customer_id,
        discounts=[{
            "coupon": "cZLa83ZZ"
        }]

but I get

Request req_7X46MB0ywlVtI2: The Checkout Session's total amount due cannot be zero in `payment` mode

however if I remove the discounts entry in the checkout session creation, this code works and successfully creates the Session.

I believe there is something wrong with the way I am using Prices, Checkout and Coupons. Any idea?

0 Answers
Related