#gironimo4 - php checkout
1 messages · Page 1 of 1 (latest)
hey there, what exactly are you trying to do? If you're set up Prices you'd want to be using the Price API to retrieve those from.
So I'm trying to update a PHP include page that includes a bunch of different price plans in an array so that each separate client facing page can pull from that plan directory rather than having to hard code the price to each page. So what the "plan" page actually looks like on that line in our legacy code is:
${'tboIOSLevel' . $examLevel . 'WeeklyPlan'} = Stripe_Plan::retrieve(${'tboIOSLevel' . $examLevel . 'WeeklyPlanId'});
${'tboIOSLevel' . $examLevel . 'WeeklyPlanName'} = ${'tboIOSLevel' . $examLevel . 'WeeklyPlan'}['name'];
${'tboIOSLevel' . $examLevel . 'WeeklyPlanPrice'} = planPrice(${'tboIOSLevel' . $examLevel . 'WeeklyPlan'});
And I guess it's an API error, but the Stripe_Plan is being reported as an unfound object type, so not sure if there's a new object that has a ::retrieve function or not
Sure that doesn't sound like an API error but instead an issue with something in the code referring to something thats not in the SDK or not imported etc
Understood, I'll get back to digging through the documentation
Generally speaking the Plan API still exists and can still be used, so that should be an issue
Ok yea thats a lot of version changes of stripe-php
The modern version of that call would be like you see here:
stripe->plans->retrieve(
'price_1It4NIA2Myiat0DZlL94sFs6',
[]
);
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'll give it a try, thanks again
but note you should still be able to call using the pattern from before the services change. We have a migration doc showing the switch from static method to client & services:
https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0
but \Stripe\Plan::retrieve('plan_123'); should also still work
OK, great, I'll keep all of these links handy
try replacing Stripe_Plan with that maybe?
Looks like we're past that error. So that syntax works, which should help. Probably have a chain of errors coming up to chase, but you've helped for now, thanks again
Great! Glad i was able to help 🙂