Skip to main content

Gateway Configuration

Gateways should include a config.json file, which defines basic configuration settings for the gateway.

Configuration Format

Example

/components/gateways/merchant/my_gateway/config.json
{
"version": "1.0.0",
"name": "My Gateway",
"description": "A gateway like no other!",
"authors": [
{
"name": "Phillips Data, Inc.",
"url": "http://www.blesta.com"
}
],
"currencies": ["EUR", "GBP", "USD"],
"signup_url": "http://www.url-to-mygateway.com"
}

Definition

OptionDescription
versionThe version of the gateway. This should be a semantic version number.
nameThe name of the gateway. This may also be a language definition.
descriptionA brief description of the gateway. This may also be a language definition in Blesta v4.9.0+.
authorsAn array of author objects.

name — The name of the author. This may be a language definition
url — The URL to link to for the author.

logoThe path within the gateway to the logo file. If not set, defaults to views/default/images/logo.png.
currenciesAn array of ISO 4217 currency codes supported by the gateway.
signup_urlThe URL to display for users that wish to open an account with the gateway (i.e. a referral URL).

Using the Configuration

To use the configuration file you must include it within the constructor of your gateway using the loadConfig() method.

/components/gateways/merchant/my_gateway/my_gateway.php
<?php
class MyGateway extends MerchantGateway implements MerchantCc {
public function __construct() {
$this->loadConfig(dirname(__FILE__) . DS . "config.json");
}

...

}
?>

If your configuration uses any language definitions, be sure to include those before loading the config.

/components/gateways/merchant/my_gateway/my_gateway.php
<?php
class MyGateway extends MerchantGateway implements MerchantCc {
public function __construct() {
Language::loadLang("my_gateway", null, dirname(__FILE__) . DS . "language" . DS);
$this->loadConfig(dirname(__FILE__) . DS . "config.json");
}

...

}
?>