Skip to content

Payment methods

xana edited this page Jan 2, 2017 · 7 revisions

Yo handle payment gateways in your app, you need to integrate them with your app. Some gateways have integrations with Stall, so integrating them in your app should be dead simple.

If no existing gateway cover your needs, you can create your own.

Existing payment gateways

Creating your own

Create a Stall::Payments::Gateway subclass in your app's lib/ folder, and implement the needed interface. This interface is not straightforward for now. It will be enhanced and documented as soon as possible, but for now, you can look at the existing implementations listed above.

class MyPaymentGateway < Stall::Payments::Gateway
end

The add it in the stall initializer :

# If the class is not in your app's autoload_paths, require it
require 'my_payment_gateway'

Stall.configure do |config|
  config.payment.register_gateway :my_payment_gateway, 'MyPaymentGateway'
end

Restart your server and you should be able to access the payment method.