#hannamitri

1 messages · Page 1 of 1 (latest)

brave yachtBOT
hollow sparrow
#

Just noticed the card details are not being saved for one-time payments

#

It's working fine for subscriptions

teal skiff
#

what code are you using exactly to take the one time payments?

hollow sparrow
#
stripeObj = {
        mode: "payment",
        line_items: [
          {
            price: PlanPriceIdB[plan],
            quantity: 1,
          },
        ],
        success_url: `${window.location.origin}/`,
        cancel_url: `${window.location.origin}/`,
        billing_address_collection: "auto",
      };
teal skiff
hollow sparrow
#

I'll try it and let you know if it works

#

Now it's showing here, but the payment methods is still empty

#

This is my new object:

stripeObj = {
        mode: "payment",
        line_items: [
          {
            price: PlanPriceIdB[plan],
            quantity: 1,
          },
        ],
        allow_promotion_codes: plan === "bootcamp",
        success_url: `${window.location.origin}/onboarding`,
        cancel_url: `${window.location.origin}/`,
        billing_address_collection: "auto",
        setup_future_usage: "off_session",
      };
teal skiff
#

that's not correct

hollow sparrow
#

oops, my bad - but i'm still getting the same result

#

I don't think it can be done inside that object

teal skiff
#

I thnk it can

#

do you have some example I can look at like your most recent PaymentIntent pi_xxxx or CheckoutSession cs_test_xxxx that has the problem?

hollow sparrow
#
stripeObj = {
        mode: "payment",
        line_items: [
          {
            price: PlanPriceIdB[plan],
            quantity: 1,
          },
        ],
        allow_promotion_codes: plan === "bootcamp",
        success_url: `${window.location.origin}/onboarding`,
        cancel_url: `${window.location.origin}/`,
        billing_address_collection: "auto",
        payment_intent_data: {
          setup_future_usage: "off_session",
        },
      };

await firebase.default
      .firestore()
      .collection("customers")
      .doc(user.uid)
      .collection("checkout_sessions")
      .add(stripeObj)
      .then((docRef) => {
        docRef.onSnapshot(async (snap) => {
          const { sessionId } = snap.data();
          if (sessionId) {
            const stripe = await loadStripe(process.env.STRIPE_KEY);
            await stripe.redirectToCheckout({ sessionId });
          }
        });
      });

That's the whole code

teal skiff
#

PaymentIntent pi_xxxx or CheckoutSession cs_test_xxxx that has the problem

#

my guess is that code you posted isn't actually running and you didn't deploy it to Firebase after changing it. Is that possible?

hollow sparrow
#

I'm still testing it on my local, let me restart my local server

#

The code looks good, right?

teal skiff
#

yes

hollow sparrow
#

Same issue

#

Do you have any idea how I can debug that?

teal skiff
#

please share a PaymentIntent pi_xxxx or CheckoutSession cs_test_xxxx that has the problem

hollow sparrow
#

pi_3NLPDYJkrlmcPYXM06pzWECN

teal skiff
#

you can see that no value came through for payment_intent_data , so the code you posted above is not what is actually running(as I said, maybe it's not deployed properly)

#

or you didn't save the .js file after making the change, or didn't restart the local server

hollow sparrow
#

I think the issue is that I'm not using stripe's API

#

Do you think that may be the problem?

teal skiff
#

I don't know what you mean by "not using Stripe's API".

hollow sparrow
teal skiff
#

that's a screenshot of ChatGPT , yep. Did you have a question to ask me here?

hollow sparrow
#

Yeah, what do you think of the answer

teal skiff
#

dunno, I am not going to read it. Did you have a question?

hollow sparrow
#

Taking into consideration I did everything you said above and it's still not working, what do you think I should do?

teal skiff
#

I think you should check that the code you posted is actually running

#

I explained to you that if you look at your API logs, you can clearly see that the parameters you say you pass in your code are not in the API request we recieve

hollow sparrow
#

It is running, because that's how I tried buying a subscription

teal skiff
#

but the code you posted has nothing to do with subscriptions

hollow sparrow
#

Sorry I meant payment

teal skiff
#

I think in any case this is a problem with that Firebase library we use

#

it only accepts certain parameters, and it ignores one it doesn't recoginse

#

that is what is happening and why it is not passing through your payment_intent_data

hollow sparrow
teal skiff
#

I suggest not using that firebase library unfortunately, it's unmaintained

hollow sparrow
#

I think that's the problem, cause there's literally nothing else

teal skiff
#

yep, I've seen that problem before

#

make sure I suppose that you are using the latest version of the Firebase extension

#

but overall, unfortuantely that library is not maintained anymore.

hollow sparrow
#

I see

#

Thanks a lot for the help