laravel / cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

Home Page:https://laravel.com/docs/cashier-paddle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with subscriptions "price_id must be a string"

Benoit1980 opened this issue · comments

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>

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.

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

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.

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.