#Mathankumar-subscriptions
1 messages · Page 1 of 1 (latest)
do one of the possible aggregate_usage modes do what you need? https://stripe.com/docs/api/prices/create#create_price-recurring-aggregate_usage
i studied that, can i use "recurring": {"aggregate_usage": max}, ??
for my scenario!
I feel like that might work, I'd suggest trying it out in test mode and seeing it it accomplishes what you're looking for
$plan = $stripe->plans->create(
[
'nickname' => 'Test plan',
'tiers' => [
['unit_amount' => 0, 'up_to' => 10,'flat_amount' => 10000],
['unit_amount' => 1000, 'up_to' => 'inf'],
],
'recurring' => ['interval' => 'month', 'aggregate_usage' => 'max'],
'currency' => 'usd',
'interval' => 'month',
'usage_type' => 'metered',
'product' => 'prod_MCoqSXPMntgSy8',
'tiers_mode' => 'graduated',
'billing_scheme' => 'tiered',
'expand' => ['tiers'],
]
); is right?
I think that's correct yep, you can try it in test mode.
it showing error like Stripe\Exception\InvalidRequestException: Received unknown parameter: recurring in file /home/mathank/Documents/projects/success-api/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php on line 38
ah right because you're using stripe->plans instead of Prices for some reason
for Plans you want to use https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage instead, note that the API shape is different(there's no recurring field, you'd pass aggregate_usage directly)
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Okay