Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Add metadata to plans. #14

Open
MSnoeren opened this issue Jun 7, 2019 · 8 comments
Open

Add metadata to plans. #14

MSnoeren opened this issue Jun 7, 2019 · 8 comments
Labels
enhancement New feature or request
Milestone

Comments

@MSnoeren
Copy link
Contributor

MSnoeren commented Jun 7, 2019

I've noticed there currently is no way to add settings or metadata to plans. For example, a plan allows for 5 users and 20 emails. Currently, I have to use an array-map to retrieve how many users the team can create. It would be easier to add this to the plan itself and get it from the plan object afterwards.

Consider the following:

// config/cashier_plans.php
'plans' => [
    'basic' => [
        'amount' => [
            'value' => '5.00',
            'currency' => 'EUR',
        ],
        'metadata' => [
            'users' => 5,
            // Any other data.
        ],
    ],
    'pro' => [
        // Other plan
    ],
]
// ...

Think of the metadata as specifying the pricing table. The metadata should then be able to be retrieved using the Plan object.. I know this can also be archieved by using config('cashier_plans.plan')[<name of plan>]['metadata'], but its a bit nicer this way. Thoughts?

Edit: after thinking about it some more, features would be a better name for this as plans have features, not settings or metadata.

@MSnoeren MSnoeren changed the title Add settings/metadata to plans. Add features to plans. Jun 9, 2019
@sandervanhooft
Copy link
Contributor

Hi @MSnoeren,

We're essentially discussing two features here:

  • metadata: I like the idea of having metadata, because it can also be accessed by the preprocessors.

  • features: would be essentially another feature, and very application specific. I don't think this should be a first class citizen as of yet. But if we go with the metadata, you could nest the features there. (metadata => features => ...)

@sandervanhooft sandervanhooft added the enhancement New feature or request label Jun 11, 2019
@sandervanhooft
Copy link
Contributor

@MSnoeren what do you think?

@MSnoeren
Copy link
Contributor Author

Looks fine to me. That way features can be added as well, but simply by adding them to the metadata.

@sandervanhooft sandervanhooft changed the title Add features to plans. Add metadata to plans. Jun 26, 2019
@sandervanhooft
Copy link
Contributor

FYI: Not sure yet I'll be including this in the v1 release. Not a must-have at this point.

@Jimmylet
Copy link

Hi @sandervanhooft, big thanks for this package! When do you think the V1 will be available?

I can't wait to use this package in production.

@sandervanhooft
Copy link
Contributor

@Jimmylet Please stay on topic; the answer you're looking for is here: #32.

@sandervanhooft sandervanhooft added this to the v2 milestone Sep 9, 2019
@pascallieverse
Copy link
Contributor

It would also be nice to have metadata for each subscription and not connected to a predefined plan.
So you could save a variable as "domainname" for example. Currently I am using the name of the subscription as foreign key to add more information to a subscription.

@sandervanhooft
Copy link
Contributor

@pascallieverse Can you open a separate issue for this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants