Spree Commerce
https://spreecommerce.org/docs/developer/core-concepts/payments
https://github.com/activemerchant/active_merchant#supported-payment-gateways
Adding your custom Payment Method
In order to make your own custom Payment Method show up on the backend list of available payment methods, you need to add it to the spree config list of payment methods first.
Firstly create a new model inheriting from Spree::PaymentMethod
in your app/models
directory:
Next, add your custom gateway to the list of available payment methods in config/initializers/spree.rb
:
Spree Braintree Vzero is a good example of a standalone custom gateway.
Payment Method visibility
We’ve mentioned before that a PaymentMethod
can have a display_on
attribute. This attribute can have the following values: front
, back
, or both
. For more granular control which Payment Methods should be available in which Store, you can override the available_for_store?
method in your PaymentMethod
subclass.
Above code will make the payment method available only for stores that support the EUR currency.
If you want more control you can specify available_for_order?
method to control Payment Method visibility for specific Order, eg.
This code will make the payment method available only for orders with a total greater than 100 and currency USD.