## Create a payment request

**post** `/v3/payment_requests`

Creates a payment request and returns a `checkout_url` the recipient
opens to pay with Apple Pay or card. Funds settle directly to your
connected Stripe account. A payment request is independent of any chat;
to associate one with a chat for your records, store the chat id in
`metadata`. Requires your connected account to be `charges_enabled`
(returns `403` otherwise).

### Header Parameters

- `"Idempotency-Key": optional string`

### Body Parameters

- `amount: number`

  Amount to charge, in the currency's minor units (e.g. cents). Must be
  at least the payment provider's minimum (50 for `usd`).

- `currency: string`

  Three-letter ISO 4217 currency code. Only `usd` is currently supported.

- `description: optional string`

  Optional description shown to the recipient at checkout.

- `metadata: optional map[string]`

  Optional key/value metadata (up to 49 keys) echoed back on retrieval
  and on `payment.*` webhooks — use it to correlate a request with your
  own records (e.g. a chat id). Keys starting with `linq_` are reserved.

### Returns

- `PaymentRequest object { id, amount, checkout_url, 9 more }`

  - `id: string`

    Unique identifier of the payment request.

  - `amount: number`

    Amount in the currency's minor units.

  - `checkout_url: string`

    URL the recipient opens to pay:
    `https://zero.linqapp.com/pay/{slug}?session=...`, where `{slug}`
    is your partner checkout slug.

  - `created_at: string`

  - `currency: string`

  - `object: string`

  - `status: "requested" or "succeeded" or "canceled" or "expired"`

    Lifecycle status of the payment request.

    - `"requested"`

    - `"succeeded"`

    - `"canceled"`

    - `"expired"`

  - `description: optional string`

  - `expires_at: optional string`

    When an unpaid request auto-expires.

  - `metadata: optional map[string]`

  - `paid_at: optional string`

    When the request was paid. Absent until it succeeds.

  - `updated_at: optional string`

### Example

```http
curl https://api.linqapp.com/api/partner/v3/payment_requests \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \
    -d '{
          "amount": 497,
          "currency": "usd",
          "description": "Coffee with Ava"
        }'
```

#### Response

```json
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "amount": 497,
  "checkout_url": "https://zero.linqapp.com/pay/tomo?session=tok_abc123",
  "created_at": "2019-12-27T18:11:19.117Z",
  "currency": "usd",
  "object": "payment_request",
  "status": "requested",
  "description": "description",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "string"
  },
  "paid_at": "2019-12-27T18:11:19.117Z",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```
