# Payment Links

The Payment Links API allows you to create, update, activate and deactivate payment links. Payment Links provides a shareable URL to accept Payment from your customers.

## Create New Payment Link

{% hint style="info" %}
**Payment Link Slug**

A payment link 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>&#x20;

**`For example,`**

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

## Create a new payment link

<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>      | 2000   | Amount to charge customer       |
| description<mark style="color:red;">\*</mark> | String | Description of the Payment Link |

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

```json
{
    "status": "success",
    "data": {
        "isActive": false,
        "type": "oneTime",
        "additionalInfoToCollect": [
            "mobile_number",
            "home_address"
        ],
        "tags": [],
        "_id": "639c8f77d62c230013cafb42",
        "name": "Gucci bag 2",
        "description": "An original gucci bag that's affordable",
        "account": "62bffdf5270d0600135de473",
        "product": "639c8f77d62c230013cafb41",
        "slug": "urbkVFD01E",
        "createdAt": "2022-12-16T15:32:07.914Z",
        "model": "Paymentlinks",
        "__v": 0
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Payment Links 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 a Payment 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 a Payment Link

## Deactivate a Payment Link

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

## Edit a Payment Link

## Edit a Payment Link

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

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

```json
{
    "name": "Gucci bag 3"
}
```

{% endtab %}
{% endtabs %}

## Get a Payment Link

## Get a Payment Link

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

## Get All Payment Link

## Get all Payment 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 a Payment Link

## Delete a Payment Link

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

Delete a payment link by ID

#### Path Parameters

| Name                  | Type   | Description |
| --------------------- | ------ | ----------- |
| {{PAYMENT\_LINK\_ID}} | String |             |

#### Query Parameters

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

## Get Transactions for a Payment Link

## Get transactions for a payment link

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

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

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

{% endtab %}
{% endtabs %}

## Get All Payment Links Transactions

## Get all payment links transactions

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

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

```json
{
    "status": "success",
    "data": [
        {
            "frontendStatus": "pending",
            "veendFee": 0,
            "otherFees": 1500,
            "purchaseReference": "uniq_ref_131223123455u7766",
            "cost": 1500,
            "merchantFee": 150,
            "customerFee": 0,
            "cashback": 37.5,
            "referralCommission": 0,
            "totalCost": 1500,
            "description": "NGN1500 - Golden Chance Lotto - uniq_ref_131223123455u7766",
            "currency": "NGN",
            "status": "pending",
            "paid": false,
            "delivered": false,
            "settled": false,
            "canRefund": false,
            "product": "63968a8377f4c0001357cbbe",
            "productsDetails": {
                "owner": "62bffdf5270d0600135de473",
                "amount": 1500,
                "currency": "NGN",
                "createdBy": "62bffdf5270d0600135de473",
                "payViaLink": true,
                "purchaseReference": "uniq_ref_131223123455u7766"
            },
            "ipAddress": "::ffff:192.168.32.85",
            "account": "62bffdf5270d0600135de473",
            "deliveryLog": null,
            "settlementLog": null,
            "refundLog": null,
            "validationDetails": null,
            "batch": null,
            "payment": null,
            "feeCalculationData": {
                "__v": 0,
                "_id": "63968a8377f4c0001357cbbe",
                "fee": 10,
                "name": "Golden Chance Lotto",
                "tags": [
                    "Golden",
                    "Chance",
                    "Lotto"
                ],
                "type": "oneTime",
                "model": "Products",
                "owner": "62bffdf5270d0600135de473",
                "amount": 1500,
                "isSync": false,
                "status": "default",
                "account": "62bffdf5270d0600135de473",
                "dueDate": "2022-12-12T01:57:23.319Z",
                "enabled": true,
                "feeType": "percentage",
                "cashback": 25,
                "currency": "NGN",
                "featured": false,
                "runCount": 0,
                "canRefund": false,
                "createdAt": "2022-12-12T01:57:23.319Z",
                "createdBy": "62bffdf5270d0600135de473",
                "updatedAt": "2022-12-12T02:00:01.370Z",
                "cashbackType": "percentage",
                "disableRetry": false,
                "additionalFee": 0,
                "hasValidation": true,
                "hasVariations": false,
                "convinienceFee": 0,
                "recurringCount": 0,
                "customerBearsFee": false,
                "hasSubVariations": false,
                "recurringInterval": "none",
                "convinienceFeeType": "percentage",
                "referralCommission": 25,
                "recurringIntervalCount": 1,
                "referralCommissionType": "percentage"
            },
            "retryCount": 0,
            "owner": "62bffdf5270d0600135de473",
            "createdBy": "62bffdf5270d0600135de473",
            "client": null,
            "developer": null,
            "tags": null,
            "_id": 268,
            "createdAt": "2022-12-12T02:07:24.000Z",
            "updatedAt": "2022-12-12T02:07:24.000Z"
        },
    ]
}
```

{% endtab %}
{% endtabs %}
