ai-payments
ai-payments copied to clipboard
Implement Stripe Multiple API Key
Changes
Add the ability to handle Stripe Multiple API Key based on currency available.
Configuration
Refer to the existing configuration options listed on ai-payments aimeos documentation
We added 1 static configuration (built-in/merged with existing config):
- multiCurrency (boolean, optional) Accept 0/1, use 1 to enable multiple stripe account
We also added 2 dynamic configuration options (inserted manually through the admin panel)
- apiKey_{currency_code}
example option name: apiKey_AUD value can be filled by the secret API key string from your Stripe account.
- publishableKey_{currency_code}
example option name: publishableKey_AUD value can be filled by publishable API key string from your Stripe account.
Behavior
2 dynamic config values will be read by the system if multiCurrency was enabled. If enabled but system doesn’t detect related apiKey with currency in the shopping cart, system will use the default Stripe account (default value from apiKey and publishableKey)
Additional Notes
currency_code values taken from what aimeos locale currencies list (ISO 4217)
Seems there's an issue with PHP setup on scrutinizer I've tried to change composer.json on a few last commits but still can't pass the test due to a PHP issue on scrutinizer Please kindly check and advise.
Thank you for your PR!
Multiple Stripe configurations are already possible without your change. Just create two payment service options and use the "Currency" decorator to limit each one to the actual currency in the basket.
Thus, it makes no sense to merge you PR but we appreciate your work very much and hope you will add further improvments to the Aimeos code base :-)