Developers

Payment gateways

Summary of payment gateway endpoints

All endpoints take optional query parameters that enhance the response objects:

  • include — enhance the response objects (e.g. include=gateway_settings). Supported values are:
    • gateway_settings - includes gateway setting data .

List all available payment gateways for the current site

Get list of all supported payment gateways for current site.

GET /admin/api/ecommerce/v1/gateways

Example response:

Status: 200 OK
[
  {
    "code": "paypal",
    "name": "paypal",
    "enabled": true,
    "enabled_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "all_payment_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "created_at": "2016-12-08T07:26:54.000Z",
    "updated_at": "2016-12-08T07:27:53.000Z",
    "url": "http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal"
  }, {
    "code": "makecommerce",
    "name": "Makecommerce",
    "enabled": false,
    "enabled_methods": [],
    "all_payment_methods": [
      "swedbank",
      "seb",
      "lhv",
      "nordea",
      "danske",
      "krediidipank",
      "pocopay",
      "citadele",
      "pohjola",
      "alandsbanken",
      "handelsbanken",
      "visa",
      "mastercard",
      "maestro"
    ],
    "created_at": null,
    "updated_at": null,
    "url": "http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/makecommerce"
  }
]

Get data for a single payment gateway

GET /admin/api/ecommerce/v1/gateways/:code

Example request:

GET http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal

Example response:

Status: 200 OK
{
    "code": "paypal",
    "name": "paypal",
    "enabled": true,
    "enabled_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "all_payment_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "created_at": "2016-12-08T07:26:54.000Z",
    "updated_at": "2016-12-08T07:27:53.000Z",
    "url": "http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal"
  }

Example request when ?include=gateway_settings is provided:

GET http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal?include=gateway_settings

Example response:

Status: 200 OK
{
    "code": "paypal",
    "name": "paypal",
    "enabled": true,
    "enabled_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "all_payment_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "supported_payment_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "settings": {
      "login": "facilitator@test.com",
      "pdt_identity_token": "xDYhshHAHACoPYtYcLfaw-wJD4DjOEsl0gjPCZuBJy-INzm0nwBVv9_yioxU0",
      "sandbox": false
    },
    "setting_fields": [
        {
          "key": "login",
          "required": true,
          "type": "string"
        },
        {
          "key": "pdt_identity_token",
          "required": false,
          "type": "string"
        },
        {
          "key": "sandbox",
          "required": false,
          "type": "boolean"
        }
    ],
    "urls": {
      "notification_url": "https://api.voog.com/ecommerce-payments/paypal/dba55538-b299-4a30-a9c6-e24ca13b3b21/notification",
      "cancel_url": "https://api.voog.com/ecommerce-payments/paypal/dba55538-b299-4a30-a9c6-e24ca13b3b21/cancel",
      "return_url": "https://api.voog.com/ecommerce-payments/paypal/dba55538-b299-4a30-a9c6-e24ca13b3b21/return"
    },
    "created_at": "2016-12-08T07:26:54.000Z",
    "updated_at": "2016-12-08T07:27:53.000Z",
    "url": "http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal"
  }

Update attributes of a single payment gateway

PUT /admin/api/ecommerce/v1/gateways/:code

This request updates the payment gateway with provided attributes.

Example request:

PUT http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal

Example data:

{
  "enabled": true,
  "enabled_methods": [
    "paypal"
  ]
}

Example response:

Status: 200 OK
{
    "code": "paypal",
    "name": "paypal",
    "enabled": true,
    "enabled_methods": [
      "paypal"
    ],
    "all_payment_methods": [
      "paypal",
      "paypal-creditcard"
    ],
    "created_at": "2016-12-08T07:26:54.000Z",
    "updated_at": "2016-12-08T07:27:53.000Z",
    "url": "http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/paypal"
  }

Parameters

  • name — name of the payment gateway.
  • enabled — controls whether the payment gateway is active.
  • enabled_methods — array of available methods that are shown in the shopping cart.
  • settings — gateway-specific settings as hash, e.g pdt_identity_token for Paypal etc.
    • Supported keys for paypal gateway (read more about PayPal):
      • login - PayPal email (required).
      • pdt_identity_token - PDT identity token (optional).
      • sandbox - sandbox mode (optional - defaults to false).
    • Supported keys for makecommerce gateway (read more about Make Commererce (Maksekeskus)):
      • shop_id - Make Commererce (Maksekeskus) shop ID (required).
      • api_key - Make Commererce shop secret key (required).
      • sandbox - sandbox mode (optional - defaults to false).

Remove a payment gateway

DELETE /admin/api/ecommerce/v1/gateways/:code

This request deletes the given payment gateway settings and disables it.

Example request:

DELETE http://helloworld.voog.com/admin/api/ecommerce/v1/gateways/:code

Example response:

Status: 204 No Content