# Create a Payment Link

This API is used to create a stablecoin payment link that can be shared with users to facilitate on-chain stablecoin payments.\
A payment link includes key information such as the payment amount, currency, wallet, and expiration time. Users can initiate payments through the link within its validity period.

* Once the user completes the on-chain transfer, a corresponding payment order is automatically generated
* Payment links are strictly bound to the merchant and wallet
* Expired payment links are no longer usable

📌 For the currently supported blockchain networks and cryptocurrencies, please refer to the following list.

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Currency</td><td valign="top">Coin ID</td><td valign="top">Network / Standard</td></tr><tr><td valign="top">USDT</td><td valign="top">2</td><td valign="top">Binance Smart Chain (BEP20)</td></tr><tr><td valign="top">USDT</td><td valign="top">2</td><td valign="top">Ethereum (ERC20)</td></tr><tr><td valign="top">USDT</td><td valign="top">2</td><td valign="top">Polygon (POS)</td></tr><tr><td valign="top">USDT</td><td valign="top">2</td><td valign="top">Solana (Mainnet)</td></tr><tr><td valign="top">USDT</td><td valign="top">2</td><td valign="top">TRON (TRC20)</td></tr><tr><td valign="top">USDC</td><td valign="top">3</td><td valign="top">Ethereum (ERC20)</td></tr><tr><td valign="top">USDC</td><td valign="top">3</td><td valign="top">Polygon (POS)</td></tr><tr><td valign="top">USDC</td><td valign="top">3</td><td valign="top">Solana (Mainnet)</td></tr></tbody></table>

***

* **Request Header: X-BH-TOKEN: `******`**
* **Request Header: Content-Type: `application/json`**
* **Request Method: `POST`**
* **Request Path: `/v2/payments/link`**
* **Authorization Required:** Yes

***

### Request Parameters

The request body should include the following parameters:

* userId: User identifier.
* merchantId: Merchant ID (required).
* amount: Payment amount (required).
* currency: Payment currency (required).
* walletId: Wallet ID (required).
* reference: Reference number for order tracking (required).
* expireSeconds: Expiration time in seconds (default: 1).

***

### Request Example

```json
{
  "userId": 1,
  "merchantId": 1,
  "amount": 100.00,
  "currency": "USDT",
  "walletId": 1,
  "reference": "INV-123456",
  "expireSeconds": 123
}
```

***

### Response Parameters

The response will contain the following parameters:

* linkId: Payment link identifier.
* paymentLink: Generated payment URL.

***

### Response Example

```json
{
  "code": 200,
  "msg": "SUCCESS",
  "data": {
    "linkId": 1,
    "paymentLink": "https://example.com/pay/123456"
  }
}
```

***

### Notes

* The `walletId` must belong to the specified merchant.
* The generated `paymentLink` can be shared with users to initiate on-chain stablecoin payments.
* Once the payment is completed on-chain, a corresponding payment order will be automatically generated by the system.
* Expired payment links cannot be used to initiate new payments.


---

# 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.velafi.com/guides/stablecoin-payments/create-a-payment-link.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.
