PaymentGateway

A payment gateway is a configuration that connects a shop to a payment provider, allowing the provider to authorize, capture, refund, and void payment transactions on behalf of the shop. Merchants use the Payment providers page in the Shopify admin to install and configure their payment gateways.

The PaymentGateway resource includes the shop's credentials for accessing the provider. An app can use this resource to install a payment gateway that enables the app to communicate with a payment provider. For example, an app that imports orders from an external marketplace can install a payment gateway to allow the marketplace to execute refund transactions through the app.

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

A large, encrypted credential used by some payment providers. If a value is provided for this property during gateway creation, then it isn't returned in the response. If no value is provided, then this property returns null.

created_at
"created_at": 2018-07-18 17:46:28 UTC

The date and time (ISO 8601 format) when the payment gateway was created.

credential1
"credential1": "QUxpFfkMo78ITaNfojJ5oJXWHbzPJunqCYm"

An encrypted credential, such as a username, a password, or an API key, that can be used to communicate with a payment provider. If a value is provided for this property during gateway creation, then it isn't returned in the response. If no value is provided, then this property returns null.

credential2
"credential2": null

An encrypted credential, such as a username, a password, or an API key, that can be used to communicate with a payment provider. If a value is provided for this property during gateway creation, then it isn't returned in the response. If no value is provided, then this property returns null.

credential3
"credential3": null

An encrypted credential, such as a username, a password, or an API key, that can be used to communicate with a payment provider. If a value is provided for this property during gateway creation, then it isn't returned in the response. If no value is provided, then this property returns null.

credential4
"credential4": null

An encrypted credential, such as a username, a password, or an API key, that can be used to communicate with a payment provider. If a value is provided for this property during gateway creation, then it isn't returned in the response. If no value is provided, then this property returns null.

disabled
"disabled": false

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

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

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

id
"id": 450789469

The ID for the payment gateway.

name
"name": "shopify_payments"

The name of the payment provider.

processing_method
"processing_method": "direct"

The type of payment processing that the payment provider uses. 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 payment gateway is operating in sandbox mode for testing purposes.

service_name
"service_name": "Shopify Payments"

The name of the payment provider that appears in the Shopify admin.

supports_network_tokenization
"supports_network_tokenization": false

Whether the payment provider supports the tokenization of a customer's credit card information. If the payment provider supports network tokenization, then it can accept digital wallets such as 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-07-18 17:46:28 UTC

The date and time (ISO 8601 format) when the payment gateway was last updated.

Endpoints

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

Retrieve a list of payment gateways

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)",
      "metadata": {},
      "created_at": "2018-07-18T13:46:28-04:00",
      "updated_at": "2018-07-18T13:46:28-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",
      "metadata": {
        "google_pay_merchant_id": 690933842
      },
      "created_at": "2011-12-31T19:00:00-05:00",
      "updated_at": "2018-07-18T13:46:28-04:00",
      "credential4": null,
      "attachment": null
    }
  ]
}

Retrieve a list of the enabled payment gateways

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",
      "metadata": {
        "google_pay_merchant_id": 690933842
      },
      "created_at": "2011-12-31T19:00:00-05:00",
      "updated_at": "2018-07-18T13:46:28-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",
    "metadata": {
      "google_pay_merchant_id": 690933842
    },
    "created_at": "2011-12-31T19:00:00-05:00",
    "updated_at": "2018-07-18T13:46:28-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": 1041204138,
    "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",
    "metadata": {},
    "created_at": "2018-07-18T13:47:10-04:00",
    "updated_at": "2018-07-18T13:47:10-04:00",
    "credential1": "someone@example.com",
    "credential3": null,
    "credential4": null,
    "attachment": null
  }
}
PUT /admin/payment_gateways/170508070.json
Updates a payment gateway

Update the payment gateway's 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)",
    "metadata": {},
    "created_at": "2018-07-18T13:46:28-04:00",
    "updated_at": "2018-07-18T13:47:11-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

Sign up for a Partner account to get started.

Sign up