#Dejan - Coach

1 messages ยท Page 1 of 1 (latest)

woeful dawnBOT
elfin raptor
#

Hey, can you share a session ID (cs_xxx)?

long pike
#

yes of course

#

cs_test_a1tTSyz1s1FU2N0i9rSvUSI3CN1IMujwaqJX1GBV2tgAbdpom0xrv7hrPT

#

const session = await stripe.checkout.sessions.create({
line_items: [
{
price: price_id,
quantity: 1,
},
],
automatic_tax: {
enabled: true,
},

    customer_update: {
      address: "never",
    },
    metadata:{
      auth0_id:auth0_session.user.sub,
      spotify_id:spotify_id,
      service_name:service_name
    },
    mode: "subscription",
    customer: stripe_id,
    success_url: `${getURL()}/payment/ok`,
    cancel_url: `${getURL()}/payment/cancel`,
  });
#

we cannot receive spotify id and service name

elfin raptor
#

That is generally indicative that the other values (spotify_id, service_name) are null/undefined (stripe-node will remove them from the API request)

#

I'd recommend logging those values before your API request and check they are indeed set as you expect

long pike
#

We console.logged them a lot of times and we have those object just before sending them through the API

#

Now we are trying to log also the object session

#

the weird thing is that sometimes it worked

elfin raptor
long pike
#

cs_test_a1hnbHvmSYuZHbMltvl1VYwnDLEUuZ8UnOpr0PrfuLJff5x2rKnafkKHXp

#

that worked, same procedure ๐Ÿ˜…

elfin raptor
#

That was yesterday too, could something have changed in your code?

#

As stated, stripe-node will omit parameters/keys were the value is null/undefined

#

That's 99% the cause here โ€“ we don't just remove parameters from API requests

long pike
#

yesterday, at that time, we made some tries and some worked but some didn't. I know that it's very weird, but we are struggling

#

We are going to log every step of checkout

elfin raptor
long pike
#

oh! it's weird because service name is there instead

#

We are trying to debug right now and I'll let you know

#

thanks

elfin raptor
#

Any luck?

long pike
#

My colleague found the bug... The problem is that basically he is a {Insert your favourite insult} ๐Ÿ˜‚

#

it worked for monthly payments and not for annual payment because the parameter was always setted as "monthly payment"

#

thanks for your patience and sorry

elfin raptor
#

np!