#Marques

1 messages · Page 1 of 1 (latest)

mint peakBOT
vast fog
valid sandal
vast fog
#

Can you share with me the subscription ID?

valid sandal
#

for example

you created Sub "A" with me

then you update for "B"

my endpoint is receiving Sub A as ID being updated to

#

sub_1NTcuFCLLdrjzwRfysA4clLS

vast fog
#

What do you mean by then you update for "B" ?

valid sandal
#

you have subscription "Basic"

then you update for subscription "Ultimate" for example

#

the system of stripe updates under customer that its new subscription is now "Ultimate"

#

but my endpoint using the webhook received "Basic" instead

vast fog
valid sandal
#

I did it vice versa

#

I will create a new one for you to follow along ok one se

#

sec

#

sub_1NTd3DCLLdrjzwRfTDzgXQ1f | Ultimate created

#

my price registered is "price_1NSDd2CLLdrjzwRffISyFJOg"

#

now changing my plan

#

as you can see here, I'm getting the metadata from the Ultimate instead of the Basic see?

vast fog
#

When is this updateSubscription function called? is it in your webhook event handler?

valid sandal
#

I've also tried going from Basic to Ultiamte memberships and I still got the same error

vast fog
#

And how did you set the metadata?

valid sandal
#

manually in the website
each of them have their own price_id in the meta data

vast fog
#

Did you update the metadata when creating the customer portal session?

valid sandal
mint peakBOT
valid sandal
#

Hello Orakaro

last viper
#

Hi there, taking over and gimme a few mins to catch up

valid sandal
#

sure

last viper
#

Sorry the content was a bit confusing. Can you list out

  1. Which Subscription Id you are currently testing?
  2. The request id when you created it req_xxx
  3. The request id when you updated it req_xxx

You can find 2 and 3 from your Dashboard log https://dashboard.stripe.com/test/logs

valid sandal
#

I will create one from scratch and get this data one sec

#

1- sub_1NTdEgCLLdrjzwRfUBaD2Iye

2- req_CSKM6lGvQr74pe

3- req_pb1yxez807TDHR

#

@last viper

last viper
valid sandal
#

yes

#

how do I get the new subscription thats being assigned in here?

#

thats the problem we are trying to figure out, because its currently passing the subscription that the user first assigned to

#

instead of getting the new one

last viper
#

Let's avoid confustion. There is only 1 Subscription. It changes the Price from price_1NSDWjCLLdrjzwRfbnN68Oev ($7) to price_1NSDZUCLLdrjzwRfH1zfJlqB ($16.5)

#

There is no old or new Subscription

valid sandal
#

ok I see what you mean makes sense

#

the problem is that we are not getting the new price thats its changing it to

#

it changes in the stripe server yes

#

but my endpoint ( from the webhook) is receiving the $7 instead of $16

last viper
#

You get the price from the metadata, correct?

valid sandal
last viper
#

Metadata doesn't change in a Customer Portal action from customer

valid sandal
#

what would be the best way to retrieve the price_id from the new price its being assigned to?

last viper
#

So there are 2 issues here:

  1. You need to figure it out how to update the latest Price Id into the Subscription metadata
  2. You... shouldn't rely on the metadata in the first place. Why don't you just retrieve the price id inside the Subscription's items?
#

I think it's more of the 2. question

valid sandal
#

the 2 is the best, but I cant find it at all

#

in the object

last viper
valid sandal
#

would it be in here?

last viper
#

Yes, navigate to its items first, what do you see?

valid sandal
#

I dont see the priceID yet

last viper
#

Yes let's look at the Data. It should be an array

#

Look at the elements inside that array

valid sandal
#

perfect finally lol

#

I get the object in a JSON object actually

#

oh wait

#

{<Stripe.Plan@18200632 id=price_1NSDZUCLLdrjzwRfH1zfJlqB> JSON: {
"id": "price_1NSDZUCLLdrjzwRfH1zfJlqB",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 1650,
"amount_decimal": 1650.0,
"billing_scheme": "per_unit",
"created": 1688970464,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": null,
"product": "prod_OEgxOjINruzgmu",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
}}

#

yes, I was able to get now the new price being assigned inside of this JSON being retrieved uhU!

last viper
#

Yep that jqB is the new Price of $16.5

#

price_1NSDZUCLLdrjzwRfH1zfJlqB

valid sandal
#

uhu sweet!

#

thanks so much for the help

last viper
#

np and good luck!

valid sandal
#

quick question since u here

#

my webhook is calling " else if (stripeEvent.Type == Events.CustomerSubscriptionUpdated)
"

even tho im just craeting a subsritpion (for the 1st time)

#

is it normal?

last viper
#

That event should only fired if the Sub is updated, ie. via the Customer Portal like you said

valid sandal
#

look
I just erased my customers and Im creating a new sub from scratch

#

my breakpoint is hitting here even tho Im just creating from scratch

#

I deleted customers from Stripe and also my db

last viper
#

So you want to look at your Subscription on Dashboard and see why did the event happen

#

Also past the Subscripiton Id directly to the Dashboard search bar

valid sandal
#

oh thats a new one

last viper
#

No I mean the search on top page

#

paste the ID there

valid sandal
#

got it

last viper
#

Scroll down you will see the request and the events related

valid sandal
valid sandal
last viper
#

The second event

#

If you click into it, what do you see?

valid sandal
valid sandal
last viper
#

from the top!

valid sandal
#

here

last viper
#

Can you give me that event id? evt_xxx

valid sandal
#

evt_1NTdaRCLLdrjzwRfGA4DUuPA

#

@last viper found

last viper
#

Ah I see, this is normal. You can see it has

  previous_attributes: {
    default_payment_method: null,
    status: "incomplete"
  }
valid sandal
#

hm

last viper
#

Which means it changes status from incomplete to active and attached a new payment method

valid sandal
#

oh I see

last viper
#

it happens when a customer paid your Checkout

valid sandal
#

oh ok just wanted to know that was all

#

thank you so much

#

the support that you guys provide

#

are just amazing

#

20 out of 10 congrats

last viper
#

Thanks for your kind words! Hope that unblocks you!