invertase / stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
https://firebase.google.com/products/extensions
Apache License 2.0
438 stars 172 forks source link

Shipping and Discounts are not being applied. #370

Open calacianu opened 2 years ago

calacianu commented 2 years ago

Bug report

Describe the bug

Shipping and Discounts are not being applied.

To Reproduce

I'm trying to create a checkout session with the following code:

const checkoutSessionRef = await firebase.firestore()
        .collection("users")
        .doc(uid)
        .collection("checkout_sessions")
        .add({
            price: priceId,
            success_url: successUrl,
            cancel_url: cancelUrl,
            subscription_data: { metadata },
            metadata,
            shipping_address_collection: {
                allowed_countries: ['RO']
            },
            shipping_options: [
                {
                    shipping_rate_data: {
                        type: 'fixed_amount',
                        fixed_amount: {
                            amount: 15 * 100, // 15 RON
                            currency: 'ron',
                        },
                        display_name: 'Transport'
                    }
                }
            ],
            discounts: [{
                coupon: couponId, // ZJeyCwtL
            }],
        });

  checkoutSessionRef.onSnapshot(async (snap) => {
          const { sessionId } = snap.data();
          const stripe = await initializeStripe();
          stripe.redirectToCheckout({ sessionId });
      });
  1. The couponId is created in the Stripe dashboard, and is the ID of the coupon object/entity. After I'm redirected to the checkout page, the discount is not applied.
  2. I'm also using a shipping rate that is described in the code above. The shipping is not applied as well.

Expected behavior

A clear and concise description of what you expected to happen.

image

If applicable, add screenshots to help explain your problem.

System information

Additional context

Add any other context about the problem here.

jsteele-stripe commented 2 years ago

@calacianu shipping_options is not a supported parameter (yet). We'll need to add it.

discounts support is tracked here: https://github.com/stripe/stripe-firebase-extensions/issues/322

calacianu commented 2 years ago

Thank you for your reply. Is there a way to handle shipping costs using the extension or using the APIs? I need to add a fix price for every product our customers purchase.

jsteele-stripe commented 2 years ago

@calacianu Checkout support shipping costs, yes. But this extension does not currently support the parameters needed to enable this.

I'll open a PR to add that.

calacianu commented 2 years ago

Hi @jsteele-stripe, is the shipping cost supported now?

Cheers

jsteele-stripe commented 2 years ago

@calacianu Not yet!

mihairaulea commented 1 year ago

How about now?

Awe-n commented 1 year ago

I just tried and it did not work. So still not implemented...

faups commented 9 months ago

@jsteele-stripe Do you have a contact at Invertase that could knock this out? Would really help our business!

Thanks