laravel / cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.
https://laravel.com/docs/cashier-paddle
MIT License
245 stars 57 forks source link

Paddle Billing support #192

Closed dommer1 closed 11 months ago

dommer1 commented 1 year ago

Paddle has launched a new version called Paddle Billing. I tried to use it with this package, but it seems that it doesn't work because Paddle Billing and Paddle Classic use different APIs. Do you have any plans to update cashier-paddle to support the new API?

For reference, here's the announcement about Paddle Billing: https://developer.paddle.com/changelog/2023/enable-paddle-billing

driesvints commented 1 year ago

Right now we don't have immediate plans, sorry.

Arielblues commented 1 year ago

Hi, I am new to paddle and also this bundle.

I try to set it up but doesn't seem to work. I guess this maybe has to do with the billing account? I registered after 8th of august. There doesn't seem to be an option to switch to classic.

driesvints commented 1 year ago

@Arielblues you're using the new Paddle Billing which this package doesn't supports.

Arielblues commented 1 year ago

Thanks for the quick feedback. I will check out other options then. If you do plan to update sooner would be very much appreciated.

crnkovic commented 1 year ago

Since Paddle Billing is now the default option for new Paddle accounts, I think a little warning in the docs that Paddle Billing is not supported by Cashier could've been a nice heads-up.

Also a notice to not use this package if your Paddle account was created after August 8th.

driesvints commented 1 year ago

I'm probably gonna start looking into a Cashier Paddle v2 soonish.

inooid commented 1 year ago

Please let us know if we can help with contributing to this @driesvints πŸ‘ Paddle Billing seems to be way closer to the way Stripe is working, so I am assuming we can keep the implementations similar as well (apart from having a solid migration path in place).

driesvints commented 1 year ago

Working on it... just a lot to dig through. Thanks!

bobbyiliev commented 1 year ago

Thank you for working on this @driesvints! Very appreciated! I was looking through their new API and it seems like that they've basically changed everything πŸ˜“

giltotherescue commented 1 year ago

Just raising my hand as interested in using Paddle Billing support πŸ™‹

Thanks to @driesvints and all others working on this initiative.

paulocastellano commented 1 year ago

Really cashier paddle package not is working with new paddle accounts.

driesvints commented 1 year ago

Hey all. We realize you all want support quickly. We’re doing our best here to provide you that but for now please have patience.

driesvints commented 11 months ago

Got the code pretty much tied up and docs almost finished. We'll be tagging an alpha release early next week for people to test out for a bit before we tag a stable release.

coolsam726 commented 11 months ago

Eagerly waiting for this. I am one of the customers who signed up to paddle after August 8th. Thanks @driesvints and the team for the amount of work you've put into this.

tinusg commented 11 months ago

Perfect timing. I'm starting on integration payments in my app in the following weeks. I'll try the alpha for sure.

kirc0de commented 11 months ago

Hi everyone!

I'm trying to use the current dev-version for my project.

I found a bug (I think it's a bug). Steps to reproduce:

  1. Use button-component: <x-cashier::button :checkout="$checkoutObj">Buy plan</x-cashier::button>
  2. Pass Checkout object as expected inside component

I got an error:

trim(): Argument #1 ($string) must be of type string, Laravel\Paddle\Checkout given

Solution was the following: add __toString() function inside Laravel\Paddle\Checkout:

public function __toString()
{
    return json_encode($this->options()); // in fact it doesn't matter what to return here
}

I understand that your solution is still in dev, but maybe my message will help you to fix it faster :)

driesvints commented 11 months ago

@kirillarutyunov I don't think you're using that correctly. Try:

<x-paddle-button :checkout="$checkout" class="px-8 py-4">
    Subscribe
</x-paddle-button>
driesvints commented 11 months ago

We've released a first alpha version btw and would love feedback on it and testing: https://github.com/laravel/cashier-paddle/tree/master

karlomikus commented 11 months ago

Hello,

seems like you are missing a method

"message": "Call to undefined method Laravel\\Paddle\\Subscription::syncSubscriptionItems()",
    "exception": "BadMethodCallException",
    "file": "/var/www/cocktails/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php",
    "line": 67,
...

Got that by calling $request->user()->subscription()->pause(); method.

Also an issue with customer update webhook:

local.ERROR: Attempt to read property "billable" on bool {"exception":"[object] (ErrorException(code: 0): Attempt to read property \"billable\" on bool at /var/www/app/vendor/laravel/cashier-paddle/src/Http/Controllers/WebhookController.php:81)
driesvints commented 11 months ago

Thanks @karlomikus. I did a new v2.0.0-alpha.2 release with fixes for these. Good finds.

karlomikus commented 11 months ago

Seems like Subscription.php -> resume() method also needs update. Resume endpoint now requires a request body with effective_from property. Following other examples in the class, I think something like this should work:

public function resume(bool $resumeNow = false)
{
    $response = Cashier::api('POST', "subscriptions/{$this->paddle_id}/resume", [
        'effective_from' => $resumeNow ? 'immediately' : 'next_billing_period',
    ])['data'];
    // ...
}

But in testing, when resuming a subscription that is active with a scheduled change to pause, I get internal server error from the paddle api (Paddle API can't process your request), hopefully this is a temporary issue on paddle sandbox side.

Other conditions like using, pauseNow() and then resume(true) work fine.

driesvints commented 11 months ago

Thanks @karlomikus. I made this PR to fix that: https://github.com/laravel/cashier-paddle/pull/206

Could you give it a look? https://github.com/laravel/cashier-paddle/pull/206

driesvints commented 11 months ago

Hello everyone in this thread. Seeing many people who want Paddle Billing support but not many people who are willing to help test the upcoming version. Can we get a little more people trying out the next version? Once it's out it's a lot harder to do changes. Thanks!

kidsdayio commented 11 months ago

@driesvints I think this is also missing

/**
     * Set the subscription model class name.
     *
     * @param  string  $subscriptionItemModel
     * @return void
     */
    public static function useSubscriptionItemModel($subscriptionItemModel)
    {
        static::$subscriptionItemModel = $subscriptionItemModel;
    }
zeknoss commented 11 months ago

Hello everyone in this thread. Seeing many people who want Paddle Billing support but not many people who are willing to help test the upcoming version. Can we get a little more people trying out the next version? Once it's out it's a lot harder to do changes. Thanks!

Hello! Is it possible for us to get a checklist on what is implemented so we can test them methodically? I have a feeling I can be better of your help in that way.

driesvints commented 11 months ago

@kidsdayio thanks, will have a look.

@zeknoss basically going through the docs and trying things out.

zeknoss commented 11 months ago

Hey @driesvints I found an issue. When receiving a "subscription.created" webhook the handler complains about missing paddle_subscription_id field in subscription_items table. The migration doesn't contain that column.

Created a PR for you: https://github.com/laravel/cashier-paddle/pull/207

driesvints commented 11 months ago

@zeknoss replied to your PR

zeknoss commented 11 months ago

Hi @driesvints ! The overlay worked pretty good. The subscription, upgrades, downgrades work good. Webhooks and being able to listen to incoming webhooks work too.

However, while I was trying to display the inline paddle element I'm getting the following error: image

I've supplied the output of checkout('price-id')->returnTo('return-url') method into the blade. When I looked at the code, I can see that the last commit was made 3 years ago so maybe could it be forgotten?

driesvints commented 11 months ago

can see that the last commit was made 3 years ago so maybe could it be forgotten

Hmm, are you sure you're looking on the master branch?

zeknoss commented 11 months ago

can see that the last commit was made 3 years ago so maybe could it be forgotten

Hmm, are you sure you're looking on the master branch?

Indeed I am.

https://github.com/laravel/cashier-paddle/tree/master/resources/views/components says so :)

driesvints commented 11 months ago

@zeknoss managed to reproduce that one and forwarded it to Paddle. Hoping to get an answer soon. Thanks for testing!

zeknoss commented 11 months ago

@zeknoss managed to reproduce that one and forwarded it to Paddle. Hoping to get an answer soon. Thanks for testing!

You're most welcome, actually you are the one I should thank. Ciao!

zahidhassanshaikot commented 11 months ago

How Can I charge from a user without auth and priceId?

And Can I generate a payment link for the subscription?

driesvints commented 11 months ago

How Can I charge from a user without auth and priceId?

That's not possible I'm afraid. You need a user up front.

And Can I generate a payment link for the subscription?

There's no concept of payment links anymore in Paddle Billing.

zahidhassanshaikot commented 11 months ago

thanks @driesvints

So How can I take a payment by only passing the amount? In my case no need to create a product or price ID and can you tell me when will be published casher-paddle v2

driesvints commented 11 months ago

So How can I take a payment by only passing the amount?

That's not possible with Paddle Billing. You always need a price ID.

jskarp commented 11 months ago

Hi you phenomenal guys that are working on this! Do you have an app. date when Paddle Billing will be available in Laravel Cashier as a first stable release?

driesvints commented 11 months ago

Out now! https://github.com/laravel/cashier-paddle/releases/tag/v2.0.0

driesvints commented 11 months ago

Thanks to everyone who helped testing πŸ‘

Kovah commented 11 months ago

Great to see Cashier supporting Billing, even if I can't upgrade from Classic.

Will there be an upgrade option once Paddle releases such an option from their side?

driesvints commented 11 months ago

@Kovah maybe. But the codebase and data scheme of Cashier Paddle changed a lot. So unsure if that would be possible.

iskrisis commented 10 months ago

So How can I take a payment by only passing the amount?

That's not possible with Paddle Billing. You always need a price ID.

@driesvints @zahidhassanshaikot Are you sure about this? It seems that https://developer.paddle.com/build/transactions/bill-create-custom-items-prices-products its possible it's just done in a bit different way.

iskrisis commented 10 months ago

I can confirm creating fully custom prices/items directly works with Paddle Billing. Not sure how it should be supported in this library but it's quite similar to the paddle classic. Instead of creating custom "checkout" and getting checkout URL you create custom transaction using API > get transaction ID > open checkout with that transaction id.

Paddle.Checkout.open({
    transactionId: "txn_abcdef12345"
});
driesvints commented 10 months ago

@iskrisis it seems this was only added a few weeks ago. We'd accept a PR for this.

https://developer.paddle.com/changelog/2023/add-custom-items-transaction

tariquedev commented 9 months ago

I used Paddle webhook like this domain.com/paddle/webhook and didn't Overriding Default Models.

ENV setup below PADDLE_SANDBOX=true PADDLE_SELLER_ID= PADDLE_API_KEY= PADDLE_WEBHOOK_SECRET=

I used the latest version and checkout is working fine with one-time payment(by price ID). Also, store data on the Customer table and Payment added to the paddle balance.

But No data is stored in the transactions table.

When I view log-on transaction.completed from webhook status it failed.

@driesvints help please Screenshot_14

driesvints commented 9 months ago

@tariquedev that seems like a weird status display. Best to contact Paddle about this.

InfinityXTech commented 8 months ago

Hello, I am unsure if this is paddle or package problem, but I get this:

image

EDIT: Configuration problem, you need to add checkout settings URL for this to work.

iRajul commented 2 months ago

@InfinityXTech set the website at https://sandbox-vendors.paddle.com/request-domain-approval it should work.