Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Webhook skipped due to invalid custom data. #83

Open
victor-ponamariov opened this issue Apr 8, 2024 · 5 comments
Open

Webhook skipped due to invalid custom data. #83

victor-ponamariov opened this issue Apr 8, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@victor-ponamariov
Copy link

Lemon Squeezy for Laravel Version

1.5.2

Laravel Version

11.1.1

PHP Version

8.3.3

Description

In LemonSqueezy I have a product which is a one-time purchase.

When a customer makes a purchase, Laravel receives the webhook. The response of the webhook request is Webhook skipped due to invalid custom data.

That happens because at the time of requesting the webhook there is no billable_id and billable_type.

How to handle the case? When somebody buys a product, I need to

  1. Create a user with the email they specified when purchasing the product
  2. Make sure that the user has bought the product (= there should be a record in the customers taable)

Plus, the user might already exist but might not be a customer (in this case, the first step should be skipped)

Is it possible to realize this scenario? If not, is it possible to override the webhook?

Thanks

Steps To Reproduce

Since it's not a bug but rather a question, there is no specific steps to reproduce. I don't know how to mark the issue as a question.

@victor-ponamariov victor-ponamariov added the bug Something isn't working label Apr 8, 2024
@driesvints
Copy link
Contributor

Unfortunately there is currently no way to handle this case. All payments need to originate from this library in order to work. This is because at the time of development, using these ID's was the only way to connect a customer in the database to the Lemon Squeezy customer. It might become easier after #53 but I don't think it will since an incoming request for a customer that isn't created to a customer in the app database is impossible to map to billable in the app. There's no way to do that afaik.

@driesvints
Copy link
Contributor

That happens because at the time of requesting the webhook there is no billable_id and billable_type.

Just to be clear: how was this purchase performed? What did you do to offer this purchase without involving the app and this library?

@victor-ponamariov
Copy link
Author

I've just added their script:

  <a href="https://myshop.lemonsqueezy.com/buy/product-id">
    Buy
  </a>

Which calls webhook after purchasing

@driesvints
Copy link
Contributor

driesvints commented Apr 8, 2024

@victor-ponamariov you need to create a user beforehand and generate the link using the library. Otherwise this library cannot know who made the purchase in your app.

@driesvints
Copy link
Contributor

Hmm, actually now that I think deeper on this what we could do maybe is make the billable columns nullable in the database and still save the customer record and the order. That way the data is synced but there's still no user attached to the customer record. But we can leave that up the app to implement depending on incoming event. I'll try to get this in for v2.

@driesvints driesvints reopened this Apr 8, 2024
@driesvints driesvints added enhancement New feature or request and removed bug Something isn't working labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants