## Cancel a payment

`client.payments.cancel(stringpaymentID, RequestOptionsoptions?): Payment`

**post** `/v3/payments/{paymentId}/cancel`

Closes the virtual card and cancels the payment.

### Parameters

- `paymentID: string`

### Returns

- `Payment`

  - `id?: string`

  - `amount_cents?: number`

  - `approval_url?: string`

    Present when the customer must approve with a passkey.

  - `attach_url?: string`

    Present when the customer must attach a card.

  - `currency?: string`

  - `description?: string`

  - `handle?: string`

  - `status?: "needs_connection" | "connecting" | "awaiting_user_action" | 6 more`

    - `"needs_connection"`

    - `"connecting"`

    - `"awaiting_user_action"`

    - `"ready"`

    - `"authorized"`

    - `"succeeded"`

    - `"declined"`

    - `"canceled"`

    - `"expired"`

### Example

```typescript
import LinqAPIV3 from '@linqapp/sdk';

const client = new LinqAPIV3({
  apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
});

const payment = await client.payments.cancel('paymentId');

console.log(payment.id);
```

#### Response

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount_cents": 2500,
  "approval_url": "approval_url",
  "attach_url": "attach_url",
  "currency": "usd",
  "description": "description",
  "handle": "+14155550123",
  "status": "ready"
}
```
