#bommerhond_unexpected

1 messages ยท Page 1 of 1 (latest)

foggy grailBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1220354595256275065

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

gray boughBOT
ember hare
#

I'd like to get the last unit number from the API per tier

hasty magnet
#

Hi there

#

Taking a look

ember hare
#

yes

#
    "type": "recurring",
    "tiers": [
      {
        "flatAmount": "0",
        "flatAmountDecimal": "0",
        "unitAmount": null,
        "unitAmountDecimal": "0.1",
        "upTo": null
      },
      {
        "flatAmount": "0",
        "flatAmountDecimal": "0",
        "unitAmount": null,
        "unitAmountDecimal": "0.2",
        "upTo": null
      }
    ]```
#

This is the response I get from the API call

hasty magnet
#

Can you share the relevant Price ID?

ember hare
#
    "id": "price_1OjNmeLlh05zOyrhVXtJFMkD",
    "active": true,
    "type": "recurring",
    "tiers": [
      {
        "flatAmount": "0",
        "flatAmountDecimal": "0",
        "unitAmount": null,
        "unitAmountDecimal": "0.1",
        "upTo": null
      },
      {
        "flatAmount": "0",
        "flatAmountDecimal": "0",
        "unitAmount": null,
        "unitAmountDecimal": "0.2",
        "upTo": null
      }
    ]
  }```
hasty magnet
#

Looking

#

Hmm I do see upTo set on that Price. Can you show me how you are retreiving the Price?

ember hare
#

$prices = $this->stripeClient->prices->all(params: ['expand' => ['data.tiers']]);

#

using Stripe's PHP client

hasty magnet
#

Hmm okay one min let me see if I can reproduce

#

Hmm strange, works just fine for me.

#

However I'm using the Node SDK

#

What version of the PHP SDK are you using?

ember hare
#

13.12.0

hasty magnet
#

I just did the same with the PHP SDK and works as well.

#

Can you try creating a brand new tiered Price and test again?

ember hare
#

yeah sure

#

Same issue

    "id": "price_1OwlYRLlh05zOyrhY1W61EnT",
    "active": true,
    "type": "recurring",
    "tiers": [
      {
        "flatAmount": null,
        "flatAmountDecimal": null,
        "unitAmount": null,
        "unitAmountDecimal": "0.5",
        "upTo": null
      },
      {
        "flatAmount": null,
        "flatAmountDecimal": null,
        "unitAmount": "2",
        "unitAmountDecimal": "2",
        "upTo": null
      }
    ]
  },```
#

oops, sent too many images ๐Ÿ˜…

hasty magnet
#

Why does your response use camel case? The response from our API should be in JSON using snake case here.

#

Like I see: "tiers": [ { "flat_amount": null, "flat_amount_decimal": null, "unit_amount": 100, "unit_amount_decimal": "100", "up_to": 1000 }, { "flat_amount": null, "flat_amount_decimal": null, "unit_amount": 200, "unit_amount_decimal": "200", "up_to": null } ],

#

For my example

ember hare
#

ah yeah good one! I'm formatting the response before returning it to my API and there's something going wrong there

#

it does return the up_to data while debugging the response that comes directly from Stripe

#

thanks for the help, I know where to look now =D