# Invoices

Numbered requests with buyers and due dates.

## List invoices

`GET /v1/invoices`

### Query parameters

- `merchantId` `string`

### Responses

#### `200`: Invoices.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `401`: Missing or unknown API key.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl 'https://api.mayarin.xyz/v1/invoices?merchantId=string'
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices?merchantId=string')
```

## Create a draft invoice

`POST /v1/invoices`

### Header parameters

- `Idempotency-Key` `string` _(required)_: Stable unique key for this logical write. Keep it unchanged when retrying.

### Request body (`application/json`)

- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string <email>`
  - `taxId` `string`
  - `address` `string`
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string`
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_
    - `asset` `string` _(required)_
  - `quantity` `integer` _(required)_
- `notes` `string`
- `metadata` `object`: Your own string pairs, sent back in webhooks. At most 20 keys of up to 64 characters, values of up to 1000, and 8 KB in all.

### Responses

#### `201`: Draft invoice created.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `400`: Validation error.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

#### `401`: Missing or unknown API key.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices \
  --request POST \
  --header 'Idempotency-Key: string' \
  --header 'Content-Type: application/json' \
  --data '{
  "merchantId": "string",
  "merchant": {
    "id": "string",
    "name": "string",
    "city": "string",
    "countryCode": "string",
    "categoryCode": "string"
  },
  "buyer": {
    "name": "string",
    "email": "string",
    "taxId": "string",
    "address": "string"
  },
  "currency": "IDR",
  "lines": [
    {
      "productId": "string",
      "name": "string",
      "unitPrice": {
        "amount": "string",
        "asset": "IDR"
      },
      "quantity": 0
    }
  ],
  "notes": "string",
  "metadata": {}
}'
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices', {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'string',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    merchantId: 'string',
    merchant: {
      id: 'string',
      name: 'string',
      city: 'string',
      countryCode: 'string',
      categoryCode: 'string'
    },
    buyer: {
      name: 'string',
      email: 'string',
      taxId: 'string',
      address: 'string'
    },
    currency: 'IDR',
    lines: [
      {
        productId: 'string',
        name: 'string',
        unitPrice: {
          amount: 'string',
          asset: 'IDR'
        },
        quantity: 0
      }
    ],
    notes: 'string',
    metadata: {}
  })
})
```

## Get an invoice

`GET /v1/invoices/{id}`

### Path parameters

- `id` `string` _(required)_

### Responses

#### `200`: Invoice with derived paid/outstanding figures.

#### `404`: No invoice with that id.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string')
```

## Update a draft invoice

`PATCH /v1/invoices/{id}`

### Path parameters

- `id` `string` _(required)_

### Header parameters

- `Idempotency-Key` `string` _(required)_: Stable unique key for this logical write. Keep it unchanged when retrying.

### Request body (`application/json`)

- `buyer` `object`
  - `name` `string` _(required)_
  - `email` `string <email>`
  - `taxId` `string`
  - `address` `string`
- `lines` `object[]`
  - `productId` `string`
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_
    - `asset` `string` _(required)_
  - `quantity` `integer` _(required)_
- `notes` `string`
- `metadata` `object`: Your own string pairs, sent back in webhooks. At most 20 keys of up to 64 characters, values of up to 1000, and 8 KB in all.

### Responses

#### `200`: Updated invoice.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `404`: No invoice with that id.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string \
  --request PATCH \
  --header 'Idempotency-Key: string' \
  --header 'Content-Type: application/json' \
  --data '{
  "buyer": {
    "name": "string",
    "email": "string",
    "taxId": "string",
    "address": "string"
  },
  "lines": [
    {
      "productId": "string",
      "name": "string",
      "unitPrice": {
        "amount": "string",
        "asset": "IDR"
      },
      "quantity": 0
    }
  ],
  "notes": "string",
  "metadata": {}
}'
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string', {
  method: 'PATCH',
  headers: {
    'Idempotency-Key': 'string',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    buyer: {
      name: 'string',
      email: 'string',
      taxId: 'string',
      address: 'string'
    },
    lines: [
      {
        productId: 'string',
        name: 'string',
        unitPrice: {
          amount: 'string',
          asset: 'IDR'
        },
        quantity: 0
      }
    ],
    notes: 'string',
    metadata: {}
  })
})
```

## Issue an invoice

`POST /v1/invoices/{id}/issue`

### Path parameters

- `id` `string` _(required)_

### Header parameters

- `Idempotency-Key` `string` _(required)_: Stable unique key for this logical write. Keep it unchanged when retrying.

### Request body (`application/json`)

- `dueAt` `string <date-time>` _(required)_
- `prefix` `string`
- `includeYear` `boolean`

### Responses

#### `200`: Issued invoice.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `404`: No invoice with that id.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string/issue \
  --request POST \
  --header 'Idempotency-Key: string' \
  --header 'Content-Type: application/json' \
  --data '{
  "dueAt": "1970-01-01T00:00:00.000Z",
  "prefix": "string",
  "includeYear": true
}'
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string/issue', {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'string',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    dueAt: '1970-01-01T00:00:00.000Z',
    prefix: 'string',
    includeYear: true
  })
})
```

## Void an invoice

`POST /v1/invoices/{id}/void`

### Path parameters

- `id` `string` _(required)_

### Header parameters

- `Idempotency-Key` `string` _(required)_: Stable unique key for this logical write. Keep it unchanged when retrying.

### Responses

#### `200`: Voided invoice.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `404`: No invoice with that id.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string/void \
  --request POST \
  --header 'Idempotency-Key: string'
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string/void', {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'string'
  }
})
```

## List an invoice in the public payable index

`POST /v1/invoices/{id}/list`

Opts the invoice into the public x402 payable index, where agents discover and pay it. The invoice stays payable by anyone holding its id either way; listing only decides whether a discovery reader is shown it.

### Path parameters

- `id` `string` _(required)_

### Responses

#### `200`: Listed invoice.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `404`: No invoice with that id, or not this merchant's.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string/list \
  --request POST
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string/list', {
  method: 'POST'
})
```

## Remove an invoice from the public payable index

`POST /v1/invoices/{id}/unlist`

### Path parameters

- `id` `string` _(required)_

### Responses

#### `200`: Unlisted invoice.

Body (`application/json`):

- `id` `string` _(required)_
- `merchantId` `string` _(required)_
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `number` `string | null` _(required)_
- `sequence` `integer | null` _(required)_
- `state` `string` _(required)_: Stored lifecycle state: draft, issued, or void.
- `buyer` `object` _(required)_
  - `name` `string` _(required)_
  - `email` `string | null` _(required)_
  - `taxId` `string | null` _(required)_
  - `address` `string | null` _(required)_
- `currency` `string` _(required)_
- `lines` `object[]` _(required)_
  - `productId` `string | null` _(required)_
  - `name` `string` _(required)_
  - `unitPrice` `object` _(required)_
    - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
    - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
    - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
    - `display` `string` _(required)_: Localized display text. Never parse this value.
  - `quantity` `integer` _(required)_
- `total` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `notes` `string | null` _(required)_
- `metadata` `object` _(required)_
- `url` `string` _(required)_
- `issuedAt` `string | null` _(required)_
- `dueAt` `string | null` _(required)_
- `voidedAt` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `version` `integer` _(required)_
- `listed` `boolean` _(required)_: Whether it appears in the public x402 payable index.

#### `404`: No invoice with that id, or not this merchant's.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string/unlist \
  --request POST
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string/unlist', {
  method: 'POST'
})
```

## Check out an issued invoice

`POST /v1/invoices/{id}/checkout`

### Path parameters

- `id` `string` _(required)_

### Header parameters

- `Idempotency-Key` `string` _(required)_: Stable unique key for this logical write. Keep it unchanged when retrying.

### Request body (`application/json`)

- `payment` `object`
  - `asset` `string` _(required)_
  - `chain` `string` _(required)_
  - `payerAddress` `string`
  - `returnAddress` `string`
- `executionPath` `string`
- `amount` `object`
  - `amount` `string` _(required)_
  - `asset` `string` _(required)_

### Responses

#### `201`: Payment intent created.

Body (`application/json`):

- `id` `string` _(required)_
- `status` `string` _(required)_: Payment intent lifecycle state.
- `merchant` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string` _(required)_
  - `city` `string` _(required)_
  - `countryCode` `string` _(required)_
  - `categoryCode` `string`
- `amount` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `settlementAsset` `string` _(required)_
- `provider` `string | null` _(required)_
- `payment` `object | null` _(required)_
  - `asset` `string` _(required)_
  - `chain` `string` _(required)_
  - `payerAddress` `string`
- `executionPath` `string | null` _(required)_
- `escrow` `object | null` _(required)_: Buyer-protection escrow terms; null for an ordinary payment.
  - `holdSeconds` `integer` _(required)_
  - `arbiter` `string`
- `source` `string` _(required)_
- `metadata` `object` _(required)_
- `merchantReference` `string | null` _(required)_
- `clearingTransactionId` `string | null` _(required)_
- `failureReason` `string | null` _(required)_
- `createdAt` `string` _(required)_
- `updatedAt` `string` _(required)_
- `expiresAt` `string` _(required)_
- `confirmedAt` `string | null` _(required)_
- `completedAt` `string | null` _(required)_

#### `404`: No invoice with that id.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/invoices/string/checkout \
  --request POST \
  --header 'Idempotency-Key: string' \
  --header 'Content-Type: application/json' \
  --data '{
  "payment": {
    "asset": "IDR",
    "chain": "ethereum",
    "payerAddress": "string",
    "returnAddress": "string"
  },
  "executionPath": "deposit-match",
  "amount": {
    "amount": "string",
    "asset": "IDR"
  }
}'
```

```ts
fetch('https://api.mayarin.xyz/v1/invoices/string/checkout', {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'string',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    payment: {
      asset: 'IDR',
      chain: 'ethereum',
      payerAddress: 'string',
      returnAddress: 'string'
    },
    executionPath: 'deposit-match',
    amount: {
      amount: 'string',
      asset: 'IDR'
    }
  })
})
```
