laravel / cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.
https://laravel.com/docs/cashier-paddle
MIT License
246 stars 57 forks source link

Issues with subscriptions "price_id must be a string" #236

Closed Benoit1980 closed 10 months ago

Benoit1980 commented 10 months ago

Cashier Paddle Version

2.1.0

Laravel Version

10.40.0

PHP Version

8.1

Database Driver & Version

10.6.15-MariaDB

Description

Hello,

When I try to create a subscription with:

                $user = Auth::user();
                $monthly1 = $user->subscribe($premium = 66132, 'default')
                    ->returnTo(route('dashboard.thankyou'));

I see a popup showing:

Something went wrong
Please try again later. If the issue persists, you can contact our support team using the button below.
[Contact support](mailto:help@paddle.com)

In the console I see: 4.af04ec6b.chunk.js:1 The price_id must be a string.

I first thought that : $user->subscribe($premium = 66132, 'default')

Needed to be changed to: $user->subscribe($premium = '66132', 'default')

But no difference.

Thank you

Steps To Reproduce

Just run this code which has to be linked to a Paddle subscription to see the error.


               $user = Auth::user();
                $monthly1 = $user->subscribe($premium = 66132, 'default')
                    ->returnTo(route('dashboard.thankyou'));

From end:

                <x-paddle-button :checkout="$monthly1" data-theme="none">
                    Buy Now
                </x-paddle-button>
driesvints commented 10 months ago

You seem to be using integer based pricing identifiers and this is not supported by Paddle Billing. Could it be that you're still using Paddle Classic? If so you need to use Cashier Paddle v1.

Benoit1980 commented 10 months ago

Thank you for the fast reply.

I have setup the subscription plan on paddle.com itself, nothing on the Laravel side, this is why I am a bit surprised about the error. All I am passing in the id of the paddle subscription to:

           $user = Auth::user();
            $monthly1 = $user->subscribe($premium = 66132, 'default')
                ->returnTo(route('dashboard.thankyou'));

image

I have upgraded to Paddle billing today(in the sandbox), perhaps they have changed the way we create subscription packages on their website? I am currently only using the sandbox by the way.

Thank you

Benoit1980 commented 10 months ago

Oh my....I have just noticed this at the bottom of the paddle screen: image

They have changed everything? No more subscription packages? So now we just create a product and it will be automatically rebilled monthly? I am surprised on this change.

Benoit1980 commented 10 months ago

Ok I will close this issue, I have managed to fix it, I really did not expect that the move from Paddle V1 to V2 would have had so many changes. It looks like Paddle now merges both the products and subscriptions into a single product page that you either set as a product or a subscription from within. Paddle ids are now strings, no more IDs. A bit of a change.

Thank you.