cashier-mollie icon indicating copy to clipboard operation
cashier-mollie copied to clipboard

Add metadata to plans.

Open MSnoeren opened this issue 6 years ago • 8 comments

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 avatar Jun 07 '19 19:06 MSnoeren

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 avatar Jun 11 '19 07:06 sandervanhooft

@MSnoeren what do you think?

sandervanhooft avatar Jun 17 '19 09:06 sandervanhooft

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

MSnoeren avatar Jun 17 '19 09:06 MSnoeren

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

sandervanhooft avatar Aug 19 '19 10:08 sandervanhooft

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.

Jimmylet avatar Aug 22 '19 06:08 Jimmylet

@Jimmylet Please stay on topic; the answer you're looking for is here: https://github.com/laravel/cashier-mollie/issues/32.

sandervanhooft avatar Aug 22 '19 10:08 sandervanhooft

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.

pascallieverse avatar Oct 24 '19 13:10 pascallieverse

@pascallieverse Can you open a separate issue for this?

sandervanhooft avatar Oct 24 '19 14:10 sandervanhooft