# Invoices

Invoices make use of the Payment Links API to create, update, activate and deactivate invoices. Invoices provides a shareable URL to accept Payment from your customers.

## Create An Invoice Link

{% hint style="info" %}
**Invoice Slug**

Invoices are shareable link. The shareable link is created by appending the slug in the JSON response to this URL - <mark style="color:blue;">**`https://pay.veendhq.com/p/`**</mark>

<mark style="color:blue;">**`https://pay.veendhq.com/p/{{SLUG}}`**</mark>
{% endhint %}

## Create a new invoice

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/v1/paymentlinks?accountId={{ACCOUNT_ID}}`

#### Query Parameters

| Name                                        | Type | Description |
| ------------------------------------------- | ---- | ----------- |
| accountId<mark style="color:red;">\*</mark> |      | Account Id  |

#### Headers

| Name                                            | Type    | Description              |
| ----------------------------------------------- | ------- | ------------------------ |
| Authorization<mark style="color:red;">\*</mark> |         | Bearer Access Token      |
| x-tag<mark style="color:red;">\*</mark>         | sandbox | Specify the environments |

#### Request Body

| Name                                          | Type    | Description                     |
| --------------------------------------------- | ------- | ------------------------------- |
| name<mark style="color:red;">\*</mark>        | String  | Name of the payment link        |
| amount<mark style="color:red;">\*</mark>      |         | Amount to charge customer       |
| description<mark style="color:red;">\*</mark> | String  | Description of the Payment Link |
| paymentType<mark style="color:red;">\*</mark> | invoice | Link                            |

{% tabs %}
{% tab title="200: OK Invoice Created Successfully" %}

```json
{
    "status": "success",
    "data": {
        "isActive": true,
        "type": "oneTime",
        "additionalInfoToCollect": [],
        "paymentType": "invoice",
        "tags": [],
        "_id": "63c5699311a93b0016f3709c",
        "name": "Gucci bag 2",
        "description": "An original gucci bag that's affordable",
        "account": "63bfcc902f650e001389f3f2",
        "image": "https://res.cloudinary.com/jimrid/image/upload/v1637149484/avatar_dlxd4x.png",
        "product": "63c5699311a93b0016f3709b",
        "dueDate": "2022-01-20T00:00:00.000Z",
        "otherAdditionalData": {
            "businessDetails": {
                "businessLogo": "https://res.cloudinary.com/jimrid/image/upload/v1637149484/avatar_dlxd4x.png",
                "businessName": "Bino supermarket",
                "businessEmail": "bino@gmail.com",
                "businessBillingAddress": "Ikaja mall",
                "country": "Nigeria",
                "state": "Lagos"
            },
            "customerDetails": {
                "customerLogo": "logo here",
                "customerName": "Ebbey Emma",
                "customerEmail": "ebbeyemma@yopmail.com",
                "addressState": "Lagos",
                "customerPhonenumber": "09779270026"
            },
            "itemDetails": [
                {
                    "description": "Item 1",
                    "quantity": 1,
                    "price": 2700
                }
            ]
        },
        "slug": "YxkZO3s1as",
        "createdAt": "2023-01-16T15:13:23.539Z",
        "model": "Paymentlinks",
        "__v": 0
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Invoices are&#x20;**<mark style="color:green;">**ACTIVE**</mark>**&#x20;by default**

Newly created payment links are <mark style="color:green;">**`active`**</mark> by default.&#x20;
{% endhint %}

### Activate an Invoice Link

## Activate a Payment Link

<mark style="color:purple;">`PATCH`</mark> `{{BASE_URL}}/v1/paymentlinks/{{PAYMENT_LINK_ID}}/activate?accountId={{ACCOUNT_ID}}`

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| accountId<mark style="color:red;">\*</mark> | String | Account Id  |

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | String |             |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Deactivate an Invoice Link

## Deactivate a Payment Link

<mark style="color:purple;">`PATCH`</mark> `{{BASE_URL}}/v1/paymentlinks/{{PAYMENT_LINK_ID}}/activate?accountId={{ACCOUNT_ID}}`

### Get a Invoice Link

## Get a Payment Link

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/v1/paymentlinks/{{PAYMENT_LINK_ID}}/activate?accountId={{ACCOUNT_ID}}`

### Get All Invoices

## Get all Invoice Links

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/v1/paymentlinks/{{PAYMENT_LINK_ID}}?accountId={{ACCOUNT_ID}}`

Returns a list all a payment links

#### Query Parameters

| Name                                        | Type        | Description                                 |
| ------------------------------------------- | ----------- | ------------------------------------------- |
| accountId<mark style="color:red;">\*</mark> | ACCOUNT\_ID |                                             |
| populate                                    | product     | returns more information about payment link |

### Delete an Invoice Link

## Delete an Invoice Link

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/v1/paymentlinks/{{PAYMENT_LINK_ID}}?accountId={{ACCOUNT_ID}}`

#### Query Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| accountId | String |             |
|           | String |             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.veendhq.com/invoices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
