# Payment Links

This feature helps you accept payment for your products or services from your customers seamlessly via a unique URL. Once the basic details described below are provided a unique link is generated and can be shared with your customers to make payment via any of our supported currencies.

## Create payment link

<details>

<summary>BaseUrl</summary>

Sandbox/PROD: <https://api.startbutton.tech&#x20>;

</details>

POST - `{{baseurl}}/paymentlink`

<table><thead><tr><th width="167">Authorization</th><th>Set value to `Bearer SECRET_KEY`</th></tr></thead><tbody><tr><td>Content-type</td><td>Set value to <code>application/json</code></td></tr></tbody></table>

<table><thead><tr><th width="161">Param</th><th width="110.33333333333331">Required?</th><th>Description</th></tr></thead><tbody><tr><td>title</td><td>Yes</td><td>This should be the name/title of the payment link </td></tr><tr><td>currency</td><td>Yes</td><td>Allowed values are: USD, NGN, GHS, KES or ZAR only</td></tr><tr><td>amount</td><td>Yes</td><td>This should be in fractional units (kobo for NGN, cents for USD). 300NGN will be passed as 30000</td></tr><tr><td>isFixedAmount</td><td>Yes</td><td><p>This should be either true or false. </p><p>If set to "true", your customers would be required to pay the amount in your request body. <br></p><p>If "false" it acts as a donation link; whereby the amount in your request will be displayed as a mere suggestion to your customers. However, your customers can enter their preferred payment amount.</p></td></tr><tr><td>type</td><td>Yes</td><td>This should always be passed as easy</td></tr><tr><td>purpose</td><td>No</td><td>This is a description of the payment link that should appear on the your dashboard when viewing the link</td></tr></tbody></table>

If the API call is successful, we will return a URL which you can share with your customers  to input their payment information in order to complete the transaction.

Here's a sample request and response

**Sample request:**

{% tabs %}
{% tab title="Required parameters" %}

```
{
  "title": "The test link",
  "currency": "NGN",
  "amount": 10000,
  "isFixedAmount": true,
  "type": "easy"
}
```

{% endtab %}

{% tab title="Optional parameters included" %}

<pre><code>{
  "title": "The test link",
  "currency": "NGN",
  "amount": 10000,
  "isFixedAmount": true,
<strong>  "type": "easy",
</strong>  "purpose": "Collect semo payment"
}
</code></pre>

{% endtab %}
{% endtabs %}

#### Sample response:

```
{
    "success": true,
    "message": "success",
    "data": {
        "paymentLink": {
            "merchantId": "64c7bd870821e8xxxxxxxxxx",
            "link": "{paymentCode}",
            "title": "The test link",
            "currency": "NGN",
            "code": "8ad6d861ba6f",
            "amount": 10000,
            "isFixedAmount": true,
            "active": true,
            "deleted": false,
            "type": "easy",
            "customEmails": [],
            "_id": "65d387381c37d1xxxxxxxxxx",
            "createdAt": "2024-02-19T16:52:08.127Z",
            "updatedAt": "2024-02-19T16:52:08.127Z",
            "__v": 0
        }
    }
}
```
