What is value to pass to the "up_to" of the last tier ( infinite ) using stripe PHP SDK?

354 views
Skip to first unread message

Cristy Sarmiento

unread,
Nov 5, 2018, 10:24:17 AM11/5/18
to Stripe API Discussion
When I pass 0 - "Invalid positive integer"
when I pass INF - Invalid tiers[up_to]: must be one of inf
pow(10, 15)  - Invalid tiers[up_to]: must be one of inf
PHP_INT_MAX  "The tiers array must include a catch all tier with up_to set to `inf` as last item."
`INF` or `inf` Missing required param: tiers[2][up_to].

thanks for the help!

Remi J.

unread,
Nov 5, 2018, 10:41:09 AM11/5/18
to api-d...@lists.stripe.com
Hello Cristy,

The API expects the string "inf" in that case and not a value specific to PHP. So your code would look like this:

$plan = \Stripe\Plan::create([
  "billing_scheme" => "tiered",
  "currency" => "usd",
  "interval" => "month",
  "product" => [
    "name" => "Gold special"
  ],
  "tiers" => [
    [
      "up_to" => 100,
      "unit_amount" => 10,
    ],
    [
      "up_to" => "inf",
      "unit_amount" => 7,
    ],
  ],
  "tiers_mode" => "volume",
]);

Hope this helps!
Remi

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages