> For the complete documentation index, see [llms.txt](https://docs.mavenseed.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mavenseed.com/developers/api/payments.md).

# Payments

## All Payments

<mark style="color:blue;">`GET`</mark> `https://yoursite.mavenseed.com/api/v1/payments`

Retrieve all payments

#### Path Parameters

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
| page | integer | Results are paginated. |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 Returns an array of payments. Only the first 20 are returned. Passing the page param will paginate the results.
" %}

```javascript
[
    {
        "id": 1,
        "customer_id": null,
        "currency": "USD",
        "transaction_id": "ch_EbQTtKjku1fMQJ",
        "created_at": "2019-02-26T16:37:51.829-05:00",
        "updated_at": "2019-02-26T16:37:51.829-05:00",
        "payable_type": "Order",
        "payable_id": null,
        "sub_total_cents": 2995,
        "tax_cents": 0,
        "total_cents": 2995,
        "paid": true,
        "attempts": 0,
        "payment_method": "stripe",
        "tax_type": "no_tax",
        "tax_rate": null
    },
    {
        "id": 1744,
        "customer_id": 1972,
        "currency": "USD",
        "transaction_id": "ch_G0HvNO6YQLdvT9",
        "created_at": "2019-10-16T14:35:44.049-04:00",
        "updated_at": "2019-10-16T14:35:44.049-04:00",
        "payable_type": "Subscription",
        "payable_id": 40,
        "sub_total_cents": 2900,
        "tax_cents": 0,
        "total_cents": 2900,
        "paid": true,
        "attempts": 0,
        "payment_method": "stripe",
        "tax_type": "no_tax",
        "tax_rate": null
    }
]
```

{% endtab %}
{% endtabs %}

## Show Payment

<mark style="color:blue;">`GET`</mark> `https://yoursite.mavenseed.com/api/v1/payments/:id`

Retrieve a single payment

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 " %}

```ruby
{
    "id": 1745,
    "customer_id": 1973,
    "currency": "USD",
    "transaction_id": "ch_G0JWRJXBLJ0VEF",
    "created_at": "2019-10-16T16:14:47.103-04:00",
    "updated_at": "2019-10-16T16:14:47.103-04:00",
    "payable_type": "Subscription",
    "payable_id": 41,
    "sub_total_cents": 2900,
    "tax_cents": 0,
    "total_cents": 2900,
    "paid": true,
    "attempts": 0,
    "payment_method": "stripe",
    "tax_type": "no_tax",
    "tax_rate": null
}
```

{% endtab %}

{% tab title="404 " %}

```ruby
null
```

{% endtab %}
{% endtabs %}

## Create Payment

<mark style="color:green;">`POST`</mark> `https://yoursite.mavenseed.com/api/v1/payments`

Create a payment.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth Token  |

#### Request Body

| Name              | Type    | Description                             |
| ----------------- | ------- | --------------------------------------- |
| customer\_id      | integer | ID of customer to attach the payment to |
| currency          | string  | Defaults to USD                         |
| transaction\_id   | string  | Typically the Stripe charge id          |
| payable\_type     | string  | Subscription, Order                     |
| payable\_id       | integer | ID of the Subscription or Order         |
| sub\_total\_cents | integer | Sub total in cents                      |
| tax\_cents        | integer | Tax amount in cents                     |
| total\_cents      | integer | Total amount in cents                   |
| paid              | boolean | Whether or not the payment is paid      |
| attempts          | integer | Attempts made to pay this payment       |
| payment\_method   | integer | 0 - stripe, 1 - manual                  |
| tax\_type         | string  | 0 - no\_tax, 1 - sales, 2 - vat         |
| tax\_rate         | number  | tax rate if tax\_type is set as vat     |

{% tabs %}
{% tab title="201 " %}

```ruby
{
    "id": 1745,
    "customer_id": 1973,
    "currency": "USD",
    "transaction_id": "ch_G0JWRJXBLJ0VEF",
    "created_at": "2019-10-16T16:14:47.103-04:00",
    "updated_at": "2019-10-16T16:14:47.103-04:00",
    "payable_type": "Subscription",
    "payable_id": 41,
    "sub_total_cents": 2900,
    "tax_cents": 0,
    "total_cents": 2900,
    "paid": true,
    "attempts": 0,
    "payment_method": "stripe",
    "tax_type": "no_tax",
    "tax_rate": null
}
```

{% endtab %}
{% endtabs %}

## Update Payment

<mark style="color:purple;">`PATCH`</mark> `https://yoursite.mavenseed.com/api/v1/payments/:id`

Update a single payment. All of the above properties in create payment are valid.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 " %}

```ruby
{
    "id": 1745,
    "customer_id": 1973,
    "currency": "USD",
    "transaction_id": "ch_G0JWRJXBLJ0VEF",
    "created_at": "2019-10-16T16:14:47.103-04:00",
    "updated_at": "2019-10-16T16:14:47.103-04:00",
    "payable_type": "Subscription",
    "payable_id": 41,
    "sub_total_cents": 2900,
    "tax_cents": 0,
    "total_cents": 2900,
    "paid": true,
    "attempts": 0,
    "payment_method": "stripe",
    "tax_type": "no_tax",
    "tax_rate": null
}
```

{% endtab %}
{% endtabs %}

## Delete a Payment

<mark style="color:red;">`DELETE`</mark> `https://yoursite.mavenseed.com/api/v1/payments/:id`

Delete a payment.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth toke   |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}
