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

Adjust for Paddle Billing v2 #100

Merged
merged 16 commits into from Apr 1, 2024
Merged

Adjust for Paddle Billing v2 #100

merged 16 commits into from Apr 1, 2024

Conversation

bobbyiliev
Copy link
Collaborator

Preparing the upgrade for the Paddle v2 billing changes:

https://developer.paddle.com/changelog/overview

@rafa-acioly
Copy link
Contributor

rafa-acioly commented Nov 7, 2023

Is there a way to use "v1" of paddle billing for now? It seems like paddle have fully migrated to v2

After installing the project and test the billing page I got the error:

{
    "errors": [
        {
            "status": 400,
            "code": "bad-request",
            "details": "One or more parameters (product id or seller) are missing."
        }
    ]
}

@bobbyiliev
Copy link
Collaborator Author

Is there a way to use "v1" of paddle billing for now? It seems like paddle have fully migrated to v2

I think that what you could do is reach out to them and ask for access to Paddle Classic so you could use the old API version.

@alfreddagenais
Copy link

Hello @bobbyiliev,

First off, I want to express my gratitude for this Pull Request. Although I understand it's still in draft mode, I found your contribution immensely helpful in adjusting my own code, especially with the significant changes in Paddle's version 2.

I have made several edits to your initial proposal to align more closely with Paddle's documentation, but I want to emphasize that the majority of your work was already very well executed.

Additionally, I'd like to offer my assistance or any ideas if you need them. Please feel free to let me know if I can contribute in any way. Your initial approach has been quite inspiring, and I'd be delighted to collaborate further on this project.

Thank you again for your valuable work on this project.

Best regards,

@bobbyiliev
Copy link
Collaborator Author

Hey @alfreddagenais! Thanks for the great feedback! I've postponed this for a bit but planning to pick it backup after the holidays.

Still debating on whether to completely switch to using the Laravel Cashier package. There has been some ongoing development for Paddle v2 but it is still under alpha release:

https://github.com/laravel/cashier-paddle/releases/tag/v2.0.0-alpha.3

Totally open to suggestions here!

@alfreddagenais
Copy link

Hey @bobbyiliev !

Thank you for your update and for considering my feedback. I completely understand the need to postpone due to the holiday season.

I wanted to share some insights from my recent experience. Yesterday, while integrating the details from the PR, I noticed there are quite a few aspects that need to be addressed in the code to achieve a more refined version for payments, especially for Wave's consumers/developers.

After thoroughly reviewing the complete documentation of Laravel Cashier (https://laravel.com/docs/10.x/cashier-paddle), I must say I'm really impressed with this package. Notably, it's already advanced to version 2.0.4 (2 days ago... not just the 2.0.0-alpha.3). In my opinion, incorporating the Cashier-Paddle package into Wave could be highly beneficial. Given the extensive features it already manages within the Laravel community, it seems counterproductive to rewrite these parts. Moreover, its webhook event management and validation features (https://github.com/laravel/cashier-paddle/releases/tag/v2.0.4) are particularly appealing.

Based on these factors, I have decided to adjust my code to utilize Cashier-Paddle. It simplifies the process significantly, reducing the amount of code and potential sources of error. This is especially crucial considering the evolving nature of payment engines.

I believe leveraging Cashier-Paddle could streamline our development process and enhance the overall functionality of Wave. Looking forward to hearing your thoughts on this!

Best regards,

PS: Just a quick note, for me is missing a issues tab in github wave project. You can track the todo, improvement, etc. And the community looking the the wave package.

@podopodo
Copy link

Hi @bobbyiliev
Thanks for your works in modifying to the new version of Paddle. From the above conversation, not sure if you'll be deciding to do away with Paddle completely. If you do however plan to stick to it,

  1. AutoFill during Paddle.Checkout.open in checkout.blade.php
  • "email" key doesn't work.
Paddle.Checkout.open({
    items: product,
    email: '@if(!auth()->guest()){{ auth()->user()->email }}@endif',
    successCallback: "checkoutComplete",
});
Paddle.Checkout.open({
    items: product,
    customer: {email: '@if(!auth()->guest()){{ auth()->user()->email }}@endif'},
    successCallback: "checkoutComplete",
});
  1. "Get Started" or Payment first and then Signup is not working with error from paddle.js
    Uncaught Error: Checkout input failed validation : Error: customer ID or email is required
    when initiating the checkout. Conditionally removing the "customer" object seems to work if its guest.
Paddle.Checkout.open({
    items: product,
    successCallback: "checkoutComplete",
});

Haven't checked on the consequent implications of these changes yet. I am new to both Laravel and Wave.

@bobbyiliev bobbyiliev requested a review from tnylea March 25, 2024 22:29
Copy link

@l-alexandrov l-alexandrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some page speed improvement suggestions.

@@ -1,11 +1,24 @@
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
<script src="https://cdn.paddle.com/paddle/v2/paddle.js" defer></script>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be working unfortunately:

Uncaught ReferenceError: Paddle is not defined
    at pricing:984:5

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess so. I didn't manage to combine my suggestion in a single entry. You need to defer the script after this one too (#100 (comment)).
We need to make sure that we try to instantiate Paddle after the paddle script is loaded.

@@ -1,11 +1,24 @@
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
<script>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract its contents to a dedicated js file and defer its loading as well.

Copy link
Contributor

@tnylea tnylea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks great to me. Excited to get this merged in 👍

@bobbyiliev bobbyiliev marked this pull request as ready for review April 1, 2024 06:01
@bobbyiliev bobbyiliev merged commit cfe8ff3 into main Apr 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants