• Version: 1.2.0

Gateways

Gateways provide access to external payment services. We have added gateways for most services are already. Because each of these services require different data and offer different settings, you cannot add new gateways. We include two gateways that you can use for testing or other payment services: Dummy and Manual. With either of these you can construct a manual version of any payment gateway not included.

If use a payment gateway that is not included, please contact us either through the support email (support@moltin.com) or on our Slack channel.

All gateways are referred to by slug. At your store URI indicated by the slug, you should build the fields and functionality necessary to complete payment using that method. That information, as well as your gateway user, password, and other information (if any), will be included in checkout operations.

Each gateway uses the following fields:

Key Type Details
name String The name of the payment gateway.
slug String The web slug for the URL of the gateway on your store.
description String An HTML-enabled field that provides more information about the payment method to the user.
enabled Boolean Whether this payment gateway is active (1) or inactive (0) on your store.
settings Array The array of settings required by this specific payment gateway. Each gateway has a unique array of settings, but may contain user names and passwords for the payment service. Retrieve a gateway by slug to see what settings it includes. NOTE: Setting names will be returned in camelCase, but must be set using lower case with_underscores format.

You can update a gateway with any data field not on this list to have it pass through directly to the gateway itself.

Before you can use this (or any endpoint), you need to authenticate to get a bearer token.

This topic will cover the following processes:

Supported Gateways

Moltin currently supports these gateways:

2checkout alipay-express alipay-secured alipay-dual alipay-wapexpress alipay-mobileexpress alipay-bank authorize-net-aim authorize-net-sim bitpay buckaroo cardsave datacash directebanking dummy eway firstdata gocardless ideal manual migs-2party migs-3party mollie mrcash multi-safepay netaxept netbanx neteller pacnet payfast payflow paymentsense paypal-express paypal-pro pin px-pay px-post realex-redirect skrill sagepay-direct sagepay-server secpay securepay stripe worldpay

Retrieve a Single Gateway by Slug

If you know the slug of the payment gateway you want to retrieve, you can use the https://api.molt.in/v1/gateways/{slug} endpoint to get information for just that one gateway.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X GET https://api.molt.in/v1/gateways/2checkout \
  -H "Authorization: Bearer XXXX"

On success, this call returns a 200 OK HTML status code and an array that contains just the gateway information for the requested slug.

{
  "status":true,
  "result":
  {
    "name":"2Checkout",
    "slug":"2checkout",
    "description":null,
    "enabled":false,
    "settings":
    {
      "accountNumber":"",
      "secretWord":"",
      "testMode":false
    }
  }
}

Remember that the contents of the settings array will differ for every gateway.

Retrieve a List of All Gateways

If you call a GET request on the https://api.molt.in/v1/gateways endpoint by inself, you can return an array that contains all of the payment gateways available to you, regardless of whether they are enabled or disabled on your store.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X GET https://api.molt.in/v1/gateways \
  -H "Authorization: Bearer XXXX"

A successful call returns 200 OK and an array of gateway information for all gateways.

Retrieve a List of All Enabled Gateways

The Moltin API offers simplified endpoints that return gateways by their enabled status. To return the enabled gateways, you append the https://api.molt.in/v1/gateways endpoint with enabled.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X GET https://api.molt.in/v1/gateways/enabled \
-H "Authorization: Bearer XXXX"

A successful call returns 200 OK and an array of gateway information for all enabled gateways.

Retrieve a List of All Disabled Gateways

Similarly, to return the disabled gateways, append the https://api.molt.in/v1/gateways endpoint with disabled.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X GET https://api.molt.in/v1/gateways/disabled \
-H "Authorization: Bearer XXXX"

A successful call returns 200 OK and an array of gateway information for all disabled gateways.

Update a Gateway

To change one or more values in a single gateway, use a PUT call with the gateway/{slug} endpoint. You can change most field values through this method, including configuring gateway-specifc settings, adding descriptions, or passing information through to the payment gateway itself. Please note that for most cURL implementations, you will have to add the -g / –globoff switch to the statement so that the brackets pass through as array indicators correctly.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X PUT https://api.molt.in/v1/gateways/:slug \
-g \
-H "Authorization: Bearer XXXX" \
-d "settings[api_key]=1A2B3C"

On success, this returns 200 OK and the updated gateway information.

Enable a Gateway

To simplify enabling gateways, you can append enable to the gateway/{slug} endpoint. This allows you to turn gateways on and off without worrying about other settings.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X GET https://api.molt.in/v1/gateways/:slug/enable \
-H "Authorization: Bearer XXXX"

On success, this call returns 200 OK and a success message.

Disable a Gateway

Similarly, to disable a gateway, append disable to the gateway/{slug} endpoint.

This functionality may be limited by access token scope. See Types of Tokens for more information.

curl -X GET https://api.molt.in/v1/gateways/:slug/disable \
-H "Authorization: Bearer XXXX"

On success, this call returns 200 OK and a success message.