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

Add option to change subscription quantity #67

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

davidsket
Copy link

In combination with #56, this will add functionality to manage subscription quantity.

@simpsoncarlos3
Copy link

hi david,
i want to use your two pull requests in my project.
as it looks like it is going to take sometime to merge.
how do i include this in my project?

i tried composer require your forked project. but didn't work
any help?

i tried extending the class with added functionality. but, didn't work. any idea?

`<?php

namespace App\Utilities;

use LemonSqueezy\Laravel\Checkout;

class LmMore extends Checkout
{
private int $quantity = 5;
private array $checkoutData = [];

public function __construct(private string $store, private string $variant)
{
    parent::__construct($store, $variant);
}

public function withQuantity(int $quantity): self
{
    $this->quantity = $quantity;
    $this->checkoutData['variant_quantities'] = [
        [
            'variant_id' => (int) $this->variant,
            'quantity' => (int) $this->quantity,
        ],
    ];
    return $this;
}

}`

@davidsket
Copy link
Author

davidsket commented Dec 12, 2023

Copy Subscription.php to your project (into app/Overrides/ for instance), then add this to composer.json

"psr-4": {
        ...
            "LemonSqueezy\\Laravel\\": "app/Overrides/"
        },
        "exclude-from-classmap": [
            "vendor/lemonsqueezy/laravel/src/Subscription.php"
        ]
}

@scottzirkel
Copy link

This looks quite helpful, my only suggestion would be to add the ability to pass through options to invoice immediately and to prorate. However, looking at the Lemon Squeezy API, it seems there's no actual way to do this?

@dominikgeimer
Copy link

Any plans to merge this pull request? Would love to see that feature and it is also on the roadmap.

@driesvints
Copy link
Collaborator

I really want to get metered billing into the package but struggling to find the time atm. In any case I plan to work on this package this fall still so please bear with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants