PaymentGateway

A payment gateway is a shop's configuration for accessing a payment provider in order to authorize, capture, refund and void credit card and other payment transactions. Merchants use the Payment providers page in Shopify admin to install and configure their payment gateways.

The PaymentGateway resource includes the shop's credentials for accessing the provider, and any other relevent information. Apps can use this resource to install a payment gateway that enables communication with a payment provider. For example, an app that imports orders from an external marketplace can install a payment gateway that enables the marketplace to execute refund transactions.

What you can do with PaymentGateway

The Shopify API lets you do the following with the PaymentGateway resource. More detailed versions of these general actions may be available:

PaymentGateway properties

attachment
"attachment": null

This is a large, encrypted credential field used by some gateways. If a value is provided for gateway creation, it does not appear in the response. Returns null if no value is provided.

created_at
"created_at": 2018-04-09 16:02:27 UTC

The date and time (ISO 8601 format) when the payment gateway record was stored by Shopify.

credential1
"credential1": "QUxpFfkMo78ITaNfojJ5oJXWHbzPJunqCYm"

Encrypted credential fields are used to communicate with gateways. They can be used for values like username, password, and API key. If a value is provided for gateway creation, it does not appear in the response. Returns null if no value is provided.

credential2
"credential2": null

Encrypted credential fields are used to communicate with gateways. They can be used for values like username, password, and API key. If a value is provided for gateway creation, it does not appear in the response. Returns null if no value is provided.

credential3
"credential3": null

Encrypted credential fields are used to communicate with gateways. They can be used for values like username, password, and API key. If a value is provided for gateway creation, it does not appear in the response. Returns null if no value is provided.

credential4
"credential4": null

Encrypted credential fields are used to communicate with gateways. They can be used for values like username, password, and API key. If a value is provided for gateway creation, it does not appear in the response. Returns null if no value is provided.

disabled
"disabled": false

Whether the gateway is currently disabled. A gateway must be enabled to process transactions.

enabled_card_brands
"enabled_card_brands": [
  "visa",
  "master",
  "american_express"
]

The credit card brands that can be used with the payment gateway.

id
"id": 450789469

A unique numeric identifier for the payment gateway.

name
"name": "shopify_payments"

The provider's name or a custom name for a custom gateway.

processing_method
"processing_method": "direct"

The payment processing method. Valid values: checkout, direct, manual, offsite or express.

provider_id
"provider_id": 1000001

The ID of the payment provider. Payment providers are configured in the Partner Dashboard.

sandbox
"sandbox": false

Whether the gateway is operating in sandbox mode for testing purposes.

service_name
"service_name": "Shopify Payments"

The description of the payment provider.

supports_network_tokenization
"supports_network_tokenization": false

Whether a gateway supports the tokenization of a customer's credit card information. Also indicates whether a payment gateway supports Apple Pay.

type
"type": "DirectPaymentGateway"

The type of the payment gateway. Common gateway types are DirectPaymentGateway, CheckoutGateway, ManualPaymentGateway, OffsitePaymentGateway, and ExpressGateway.

updated_at
"updated_at": 2018-04-09 16:02:27 UTC

The date and time (ISO 8601 format) when the order was closed.

Endpoints

GET /admin/payment_gateways.json
Retrieves a list of configured payment gateways.

Get a list of payment gateways for a specified shop

GET /admin/payment_gateways.json
View Response
HTTP/1.1 200 OK
{
  "payment_gateways": [
    {
      "disabled": true,
      "id": 170508070,
      "name": "Cash on Delivery (COD)",
      "provider_id": 140,
      "sandbox": false,
      "supports_network_tokenization": null,
      "type": "ManualPaymentGateway",
      "enabled_card_brands": [],
      "processing_method": "manual",
      "service_name": "Cash on Delivery (COD)",
      "created_at": "2018-04-09T12:02:27-04:00",
      "updated_at": "2018-04-09T12:02:27-04:00"
    },
    {
      "disabled": false,
      "id": 730284545,
      "name": "shopify_payments",
      "provider_id": 87,
      "sandbox": false,
      "supports_network_tokenization": null,
      "type": "DirectPaymentGateway",
      "enabled_card_brands": [
        "visa",
        "master",
        "american_express"
      ],
      "processing_method": "direct",
      "service_name": "Shopify Payments",
      "created_at": "2011-12-31T19:00:00-05:00",
      "updated_at": "2018-04-09T12:02:27-04:00",
      "credential4": null,
      "attachment": null
    }
  ]
}

Get a list of the enabled payment gateways for a specified shop

GET /admin/payment_gateways.json?disabled=false
View Response
HTTP/1.1 200 OK
{
  "payment_gateways": [
    {
      "disabled": false,
      "id": 730284545,
      "name": "shopify_payments",
      "provider_id": 87,
      "sandbox": false,
      "supports_network_tokenization": null,
      "type": "DirectPaymentGateway",
      "enabled_card_brands": [
        "visa",
        "master",
        "american_express"
      ],
      "processing_method": "direct",
      "service_name": "Shopify Payments",
      "created_at": "2011-12-31T19:00:00-05:00",
      "updated_at": "2018-04-09T12:02:27-04:00",
      "credential4": null,
      "attachment": null
    }
  ]
}
GET /admin/payment_gateways/730284545.json
Retrieves a specific payment gateway

Get a representation of a single payment gateway

GET /admin/payment_gateways/#{payment_gateway_id}.json
View Response
HTTP/1.1 200 OK
{
  "payment": {
    "disabled": false,
    "id": 730284545,
    "name": "shopify_payments",
    "provider_id": 87,
    "sandbox": false,
    "supports_network_tokenization": null,
    "type": "DirectPaymentGateway",
    "enabled_card_brands": [
      "visa",
      "master",
      "american_express"
    ],
    "processing_method": "direct",
    "service_name": "Shopify Payments",
    "created_at": "2011-12-31T19:00:00-05:00",
    "updated_at": "2018-04-09T12:02:27-04:00",
    "credential4": null,
    "attachment": null
  }
}
POST /admin/payment_gateways.json
Creates a payment gateway, specifying the ID of the payment provider

Create a payment gateway

POST /admin/payment_gateways.json
{
  "payment_gateway": {
    "credential1": "someone@example.com",
    "provider_id": 7
  }
}
View Response
HTTP/1.1 201 Created
{
  "payment_gateway": {
    "disabled": false,
    "id": 1041204140,
    "name": "authorize_net",
    "provider_id": 7,
    "sandbox": false,
    "supports_network_tokenization": null,
    "type": "DirectPaymentGateway",
    "enabled_card_brands": [
      "visa",
      "master",
      "american_express",
      "discover",
      "diners_club",
      "jcb"
    ],
    "processing_method": "direct",
    "service_name": "Authorize.net",
    "created_at": "2018-04-09T12:03:01-04:00",
    "updated_at": "2018-04-09T12:03:01-04:00",
    "credential1": "someone@example.com",
    "credential3": null,
    "credential4": null,
    "attachment": null
  }
}
PUT /admin/payment_gateways/170508070.json
Updates a payment gateway

Update sandbox status to true

PUT /admin/payment_gateways/#{payment_gateway_id}.json
{
  "payment_gateway": {
    "id": 170508070,
    "sandbox": true
  }
}
View Response
HTTP/1.1 200 OK
{
  "payment_gateway": {
    "disabled": false,
    "id": 170508070,
    "name": "Cash on Delivery (COD)",
    "provider_id": 140,
    "sandbox": true,
    "supports_network_tokenization": null,
    "type": "ManualPaymentGateway",
    "enabled_card_brands": [],
    "processing_method": "manual",
    "service_name": "Cash on Delivery (COD)",
    "created_at": "2018-04-09T12:02:27-04:00",
    "updated_at": "2018-04-09T12:03:02-04:00"
  }
}
DELETE /admin/payment_gateways/170508070.json
Deletes a payment gateway

Delete a payment gateway

DELETE /admin/payment_gateways/#{payment_gateway_id}.json
View Response
HTTP/1.1 204 No Content