enupal / stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS
https://enupal.com/craft-plugins/stripe-payments/
Other
33 stars 19 forks source link

Feature Request: Make config more "Craft-like" #242

Open peteeveleigh opened 2 years ago

peteeveleigh commented 2 years ago

Having separate handles for Test and Live keys is counter to the way Craft and Craft Plugins are normally configured.

It would be more "native" to be able to use a single set of handles and then assign values based on the environment - after all, that's why Environment Variables exist.

For instance, instead of:

'stripePayments' => [
    'testPublishableKey' => getenv('STRIPE_TEST_PUBLISHABLE_KEY'),
    'testSecretKey' =>  getenv('STRIPE_TEST_SECRET_KEY'),
    'testMode' => 1,
    'testWebhookSigningSecret' => getenv('STRIPE_TEST_WEBHOOK_SIGNING_SECRET'),
]

It would be possible to set

'stripePayments' => [
    'publishableKey' => getenv('STRIPE_PUBLISHABLE_KEY'),
    'secretKey' =>  getenv('STRIPE_SECRET_KEY'),
    'testMode' => getenv('STRIPE_TEST_MODE'),
    'webhookSigningSecret' => getenv('STRIPE_WEBHOOK_SIGNING_SECRET'),
]

The values for those variables would be different depending on my environment so there's no need to use different different handles.

For extra merit, being able to set other configuration options from a file would also be very useful.

Finally, it would also be nice if it were possible to set this up in a separate config file, stripe-payments.php rather than the general.php config.

zizther commented 8 months ago

Agreed, support for a plugin config file would be a nice way to manage settings with the use of ENV vars. Is this something which would be supported @andrelopez