# Create Template

<figure><img src="https://3353622060-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRIvNeAljKee4MyCDRI9m%2Fuploads%2FRxq8cJPkAwy9ED0DgOv1%2Fimage.png?alt=media&#x26;token=b3a56cb6-c99d-473f-adb1-7bda846bb9c8" alt=""><figcaption><p>Payment link template above</p></figcaption></figure>

Here your payment link will looks like this, you can customize it according to your needs like logo, button color etc and also functionality wise, you need tip text box or not.&#x20;

#### **Method**

```

POST https://api.ninjapay.me/webextension/api/v1/fiat/realtime-payment-link/link

```

**Parameters**

* logo: `String` - Logo which you want to show on the template (required).
* brand\_color:  `String` - Brand color of template (required).
* accent\_color:  `String` - Accent/Button color of template (required).
* enable\_tips: `Boolean` - Tips should be enable or not to customers.
* include\_order\_id: `Boolean` - order id will be added in redirect url, mus pass redirect url
* default\_currency: `String` - Currency of your amount
* redirect\_url: `String` - What url will be redirecting after payment success.
* webhook : `String`- Webhook url on which you want to send payment link updates.
* tnc\_url: `String` - What url will be show in term and condition link..
* default\_thanks\_msg: `string` - What  thanks message will be shown to the user.
* default\_btn\_text: `String` -  What  default btn text message will be shown to the user.
* donation\_text: `String` - donation text to show to user..
* donation\_percent: `String` - Phone number of customer without phone code.
* cust\_phone: `String` - Phone number of customer without phone code
* only\_phone: `String` - Link will only ask customer's email
* is\_sms: `Boolean` - You will get SMS alert after payment
* is\_whatsapp: `Boolean` - You will get message on whatsapp regarding payment
* is\_invoice\_generate: `Boolean` : Invoice generation will be given after payment or not
* enable\_upi\_qr: `Boolean` - Upi link will be coming in response
* cust\_reference\_id: `String` - Id you can pass your custom reference id
* include\_cust\_ref\_in\_payment\_link: `Boolean` -Include customer reference in the payment link
* cust\_thanks\_msg: `String` - Message shown to customer after payment
* custom\_logo\_url: `String` - Your personalize logo
* custom\_pay\_text: `String` :- Text shown to customer during payment
* tnc: `String` - Terms and conditions
* reference\_notes: `String` - Reference note
* expiry\_id: `String` - Pass Id according to expire time setting
* reference\_order\_id: `String`- User side order id to attach to orders.
* allow\_tips: `Boolean`- Tips field show to customer or not.

Other info

* If no `expiry_id`  is passed then link will be having no expiry date
* if `include_order_id_in_redirect` is passed to true then you need to pass redirection url also
* If `cust_phone` is passed, you also need  to pass `phone_code(country phone number codes)` .
* We can only pass max 1 lakh amount If `allow_partial_payment`  is false

### Request body

{% code fullWidth="true" %}

```json

Body (application/json)
{
    "type": "1",
    "template_id": "null",
    "title": "title of paymeny link",
    "currency": "INR",
    "amount": 1,
    "allow_partial_payment": false,
    "single_use": false,
    "cust_phone": "8302280166",
    "cust_email": "example.com",
    "cust_full_name": "dummy name",
    "ask_during_payment": false,
    "only_phone": false,
    "phone_code": "+91",
    "only_email": false,
    "link_expiry": null,
    "is_sms": false,
    "is_whatsapp": false,
    "is_invoice_generate": false,
    "enable_upi_qr": false,
    "include_order_id_in_redirect": false,
    "cust_reference_id": "",
    "include_cust_ref_in_payment_link": false,
    "redirect_url": "",
    "cust_thanks_msg": "",
    "custom_logo_url": "",
    "custom_pay_text": "",
    "tnc": "",
    "reference_notes": "",
    "expiry_id": null,
    "allow_tips":false,
    "webhook":"",
    "reference_order_id":""    
}
```

{% endcode %}

#### **Other info**

| Parameters | Input options                                                                       |
| ---------- | ----------------------------------------------------------------------------------- |
| type       | <p>Type of the payment link- </p><p>1 -> payment link<br>2 -> Subscription link</p> |
|            |                                                                                     |

#### **Response**

```json

{
    "status": true,
    "data": {
        "link_id": "RTLSpvmCCWL5YbgoQIy1uKO", // id of this payment link
        "super_order_id": "FT_RTPL_SOeK5pKhG51kOcMYaNNGTL", 
        "qr_base64": "", // base 64 image of qr if qr customise is been done
        "pay_link": "", // upi link for direct payment
        "expiry_date": "2024-08-06 08:52:11", // expiry of invoice
        "order_id": "FT_RTPL_SOTbKI1uC7uYfGMvDvOAw9" // 
    },
    "message": "Payment link created successful"
}
```

### Payment Success Response

Upon successful payment, the Ninjapay platform sends the fiat amount to the provided UPI ID and gives a success response to the **webhook**.

#### Callback Response

```json
{
    "STATUS":"",  // 
    "ORDER_ID":"",
    "CURRENCY":"",
    "RESP_MSG":"",
    "PAYMENT_MODE":"",
    "TXN_ID":"",
    "AMOUNT":"",
    "CUS_REF_ID":"",
    "TXN_DATE":"",
    "CHECKSUMHASH":"",
    "REFERENCE_ORDER_ID":""
}
```

#### **Code Example**

{% code overflow="wrap" %}

```javascript

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY'
  },
  body: '{"amount":10,"title":"sample_description","reference_order_id":"myperosnalid","webhook":"https://yourwebhook.com" }'
};

fetch('https://api.ninjapay.me/webextension/api/v1/fiat/realtime-payment-link/link', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  
```

{% endcode %}
