Simply take a look at the linked code above and notice why this won't work
#
Or
Create your own payment plugin, or copy the example plugin and replace all instances of example/Example to avoid issues, including file names.
Enable the new plugin in the dashboard
Try to checkout and notice how the new plugin doesn't show up as availabe payment option, while there is no error thrown (and no hint of it in reacts virtual dom inspector.)
Manually add paymentMethods.name as key + the name of the component you registered as value to the templates object in the file linked above.
Verify that the payment option is displayed now.
Possible Solution
The availablePaymentMethods query already lists available payment options, including custom ones.
It returns name and pluginName.
Option A: add an additional field to be returned from the query, e.g. templateName
Option B: Enforce a naming convention like it is done for capture/authorize methods, and derive the component name from pluginName.
Issue Description
The array for available payment templates is hardcoded in v2.x. I noticed this while reimplementing my Paypal Express Integration.
In imports/plugins/core/payments/client/checkout/payment/methods.js there are template names defined for the included plugins, ignoring custom plugins that might be added.
Steps to Reproduce
Possible Solution
The
availablePaymentMethods
query already lists available payment options, including custom ones. It returns name and pluginName.Option A: add an additional field to be returned from the query, e.g. templateName Option B: Enforce a naming convention like it is done for capture/authorize methods, and derive the component name from pluginName.
Versions
v2.0.0-rc.7