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

Cashier::findBillable($customerId) not returning anythying #239

Closed Benoit1980 closed 10 months ago

Benoit1980 commented 10 months ago

Cashier Paddle Version

2.1.0

Laravel Version

10.4.1

PHP Version

8.1

Database Driver & Version

mariadb

Description

Not getting any output with:

use Laravel\Cashier\Cashier;

$user = Cashier::findBillable($customerId);

Steps To Reproduce

Hi,

I followed your documentation:

Here is my test: $user = Auth::user(); // This user has an active subscription logger($user);

Output: {"id":397,"name":"kay","email":"xxxxxxxxxxxxxxxx@gmail.com","email_verified_at":"2023-12-04T22:20:03.000000Z","created_at":"2023-11-22T22:33:37.000000Z","updated_at":"2024-01-18T14:32:27.000000Z","paddle_id":null,"paddle_email":null,"trial_ends_at":null,"total_credits":39494,"current_credits":200000,"account_restriction":0,"dashboard_notifications":0,"roles":[{"id":2,"name":"customer","guard_name":"web","created_at":"2022-09-01T20:53:39.000000Z","updated_at":"2022-09-01T20:53:41.000000Z","pivot":{"model_type":"App\\Models\\User","model_id":397,"role_id":2}}]}

$results = Cashier::findBillable($user->id);

The Return is empty

I also tried to pass the paddle_id instead of the user_id form the subscription table, but no returns either.

Thank you.

driesvints commented 10 months ago

This method requires a Paddle customer id, not a user ID. https://laravel.com/docs/10.x/cashier-paddle#retrieving-customers

Benoit1980 commented 10 months ago

Got it, thanks!