# Payment Method Resource

PaymentMethod resources are read-only by default.

### Attention

PaymentMethod resources are read-only by default. Please contact us if you need write permissions.

---

## Get Payment Methods

GET /api/payment_methods.json

- **GET /api/payment_methods.json** will return the first 150 (default limit) payment methods. You can increase the limit to a maximum of 250 payment methods. See the [Filter Payment Methods](#filter-payment-methods) endpoint for more info.

**Example:**

```bash
$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/payment_methods.json
```

```
Status: 200 OK

[
  {
    "payment_method": {
      "active": true,
      "cost": "2.5",
      "description": "The DHL courier collects the amount on delivery.",
      "gateway": "0",
      "id": 100,
      "name": "cod",
      "registered_customer_only": false,
      "title": "Nachnahme"
    }
  },
  {
    "payment_method": {
      "active": true,
      "cost": "0.0",
      "description": "",
      "gateway": "paypal",
      "id": 101,
      "name": "paypal",
      "registered_customer_only": false,
      "title": "PayPal"
    }
  },
  {
    "payment_method": {
      "active": true,
      "cost": "0.0",
      "description": "",
      "gateway": "stripe",
      "id": 102,
      "name": "cc",
      "registered_customer_only": false,
      "title": "Kreditkarte"
    }
  }
]
```

---

## Get Payment Method

GET /api/payment_methods/:payment_method_id.json

- **GET /api/payment_methods/:payment_method_id.json** will return the specified payment method.

**Example:**

```bash
$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/payment_methods/:payment_method_id.json
```

```
Status: 200 OK

{
  "payment_method": {
    "active": true,
    "cost": "0.0",
    "description": "",
    "gateway": "paypal",
    "id": 101,
    "name": "paypal",
    "registered_customer_only": false,
    "title": "PayPal"
  }
}
```

---

## Get Payment Methods Count

GET /api/payment_methods/count.json

- **GET /api/payment_methods/count.json** will return the payment methods count.

**Example:**

```bash
$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/payment_methods/count.json
```

```
Status: 200 OK

{
  "count": 3
}
```

---

## Filter Payment Methods

GET /api/payment_methods.json?filter_name 1 = filter_value 1 & filter_name 2 = filter_value 2

## - GET /api/payment_methods.json?filter_name_1=filter_value_1&filter_name_2=filter_value_2 will return a filtered list of products. See the [Get Payment Methods](#get-payment-methods) endpoint for more info about the output.

### **Available Filters and Options**

| Filter-/Optionname | Description | Type | Parameter |
|---|---|---|---|
| limit | The amount of results, defaults to 150, maximum are 250 | Integer | limit=10 |
| offset | The amount of results to omit | Integer | offset=10 |
| active | Filter by active | Boolean | active=true |
| name | Filter by name | String | name=paypal |
| registered_customer_only | Filter by registered_customer_only | Boolean | registered_customer_only =true |
| id_min | Filter payment methods by the minimum id | Integer | id_min=10 |
| id_max | Filter payment methods by the maximum id | Integer | id_max=10 |
| cost_min | Filter payment methods by the minimum price | BigDecimal | cost_min=100.0 |
| cost_max | Filter payment methods by the maximum price | BigDecimal | cost_max=100.0 |

- **GET /api/payment_methods.json?active=true&cost_max=0.00** will return all products and variants (not nested). See the [Get Payment Methods](#get-payment-methods) endpoint for more info about the output.

**Example:**

```bash
$ curl -s \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-u APP_API_KEY:APP_API_PASSWORD \
-X GET \
https://shop_subdomain.versacommerce.de/api/payment_methods.json?active=true&cost_max=0.00
```

```
Status: 200 OK

[
  {
    "payment_method": {
      "active": true,
      "cost": "0.0",
      "description": "",
      "gateway": "paypal",
      "id": 101,
      "name": "paypal",
      "registered_customer_only": false,
      "title": "PayPal"
    }
  },
  {
    "payment_method": {
      "active": true,
      "cost": "0.0",
      "description": "",
      "gateway": "stripe",
      "id": 102,
      "name": "cc",
      "registered_customer_only": false,
      "title": "Kreditkarte"
    }
  }
]
```
