Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix missing lemon_squeezy_id if billable was on generic trial #52

Merged
merged 1 commit into from
Nov 2, 2023
Merged

Fix missing lemon_squeezy_id if billable was on generic trial #52

merged 1 commit into from
Nov 2, 2023

Conversation

pdziewa
Copy link
Contributor

@pdziewa pdziewa commented Oct 31, 2023

Hi there!

I've encountered a small issue in my app.

During user registration, I initiate a generic trial with:

$user->createAsCustomer([
    'trial_ends_at' => now()->addDays(7)->endOfDay(),
]);

After this process, the Customer appears as follows:

LemonSqueezy\Laravel\Customer {#2544
    id: 9,
    billable_id: 16,
    billable_type: "App\Models\User",
    lemon_squeezy_id: null,
    trial_ends_at: "2023-11-07 23:59:59",
    created_at: "2023-10-31 18:29:25",
    updated_at: "2023-10-31 18:29:25",
}

When a user decides to subscribe, the app receives webhooks from Lemon Squeezy. One of these events is subscription_created which sets trial_ends_at to null but didn't update lemon_squeezy_id.

@pdziewa pdziewa marked this pull request as ready for review October 31, 2023 18:39
@driesvints driesvints merged commit 0787978 into lmsqueezy:main Nov 2, 2023
@driesvints
Copy link
Contributor

Thanks! I'll squeeze this in for now but since Lemon Squeezy has a new create endpoint for customers I think we can use that in the future so we no longer have to rely on the "billable_id" & "billable_type" custom data. I'll have a look at that whenever I get to it.

@pdziewa pdziewa deleted the fix-missing-lemon-squeezy-id-for-existing-customer branch November 2, 2023 13:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants