Comments (4)
Thanks @haszzam. Would maybe not filtering on status be the solution here to fetch all customers?
from cashier-paddle.
Hi @driesvints
I checked the other discussion and it's the same issue I'm having here.
In your reply here #218 (comment)
You're assuming the customer already exists in the database, and if it does, then ya the createAsCustomer()
checks to see if the billable model has a customer attached to it in the daatabse and if so it simply returns this customer instance.
The issue arise when you delete the customer from the database and leave the billable and then try to run createAsCustomer()
again on the same billable instance.
The best way to understand this issue is to reproduce it locally on your end with the following steps:
- Install a fresh laravel app
- Install and configure Cashier (Paddle)
- Run the migration
- Add the following code to
DatabaseSeeder.php
file
public function run(): void
{
$user = \App\Models\User::factory()->create([
'name' => 'John Doe',
'email' => '[email protected]',
'password' => bcrypt('password'),
'email_verified_at' => now(),
]);
$user->createAsCustomer();
}
- Run
php artisan db:seed
to create the demo user above - Run
php artisan migrate:fresh
to clear the database - Run
php artisan db:seed
to re-create the user again
The last command should fail, because the a customer with this email [email protected]
already exists inside paddle.
So the whole point of this method createAsCustomerIfNotExists()
is to prevent this failure by checking first if a customer with the same email exists inside paddle before attempting to create a new one.
Again, It's unlikely anyone gonna have this issue in a production environment, It's mostly gonna happen in development where you clear the database for whatever reason.
So This method would only make development a little easier, I don't know if it would make sense to add it to the library but I don't think it would hurt anyway to have available as an option.
from cashier-paddle.
Thanks @haszzam. Paddle has fixed the filter issue. I've sent in a fix for this now here: #220
Please note that this still will only re-add the customer record. Any previous subscription and transaction records aren't re-added.
from cashier-paddle.
Hi @driesvints.
Ya I understand it will only create an empty customer instance.
Thanks!
from cashier-paddle.
Related Issues (20)
- Disable generic trial once customer is subscribed HOT 1
- Fix incrementQuantity() & decrementQuantity() Throwing Error HOT 5
- Notice in the docs about "default checkout URL" HOT 1
- [2.x] add end at of the subscription period HOT 1
- Fix nextPayment() total HOT 1
- returnTo function added to checkout does not redirect HOT 6
- Bill for non-catalog items HOT 6
- Issues with subscriptions "price_id must be a string" HOT 4
- Webhook duplicating the response statuses HOT 8
- Cashier::findBillable($customerId) not returning anythying HOT 2
- Get subscription payment method HOT 1
- Add support for authentication via client-side tokens HOT 1
- Paddle webhook handler doesnt work HOT 10
- Laravel cashier-paddle package conflict with passport Auth Header HOT 1
- Paddle with Passport giving: Authentication header included, but incorrectly formatted HOT 3
- Pausing Subscriptions HOT 1
- Applying a discount on checkout HOT 1
- Problem with billing API - Transaction not created in the db HOT 13
- Changing email on the payment screen HOT 5
- Activate subscription is not working. HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cashier-paddle.