# Create payment link

> Create a hosted payment link and return its Payment Link ID and checkout URL.

```yaml
openapi: 3.1.0
info:
  title: Create payment link
  version: 1.0.0
  description: Create a hosted payment link and return its Payment Link ID and checkout URL.
paths:
  /v1/txn/paymentLink/add:
    post:
      summary: Create payment link
      description: Create a hosted payment link and return its Payment Link ID and
        checkout URL.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                merchantNo:
                  type: string
                  description: Merchant number assigned by Onerway. See
                    [Setup](/payments/get-started/setup#retrieve-your-credentials)
                    for how to obtain it.
                linkName:
                  type: string
                  description: Display name for the payment link, used to identify the link in
                    list queries and merchant operations.
                amount:
                  type: number
                  description: Payment amount in the specified currency. Use integer values for
                    zero-decimal currencies. Format rules follow [currency and
                    amount
                    validation](/payments/get-started/currency-and-amount).
                currency:
                  type: string
                  description: Payment currency as a three-letter [ISO
                    4217](https://en.wikipedia.org/wiki/ISO_4217) currency code
                    that matches `amount`.
                defaultCountry:
                  type: string
                  description: Default country or region code used on the payment link checkout
                    page. The recommended format is a two-letter [ISO 3166-1
                    alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
                    country code.
                itemName:
                  type: string
                  description: Name of the goods or services shown to the customer.
                description:
                  type: string
                  description: Description of the goods or services shown to the customer.
                collectEmail:
                  type: boolean
                  description: Whether the payment link checkout page collects the customer email
                    address.
                collectName:
                  type: boolean
                  description: Whether the payment link checkout page collects the customer name.
                sign:
                  type: string
                  description: Request signature string. See [Request
                    signing](/payments/get-started/request-signing) for how to
                    generate it.
              required:
                - merchantNo
                - amount
                - currency
                - defaultCountry
                - itemName
                - sign
            examples:
              create-payment-link:
                summary: Create payment link
                value:
                  amount: 99.99
                  collectEmail: true
                  collectName: true
                  currency: USD
                  defaultCountry: US
                  description: Demo product description
                  itemName: Demo product
                  linkName: Demo payment link
                  merchantNo: replace_with_merchant_no
                  sign: "{{SIGN}}"
      responses:
        "200":
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: "`20000` means the create request was processed successfully. Other
                      values are error codes. See [Response
                      codes](/payments/api-reference/response-codes)."
                  respMsg:
                    type: string
                    description: Human-readable message for the response code.
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Payment Link ID.
                      linkUrl:
                        type: string
                        description: URL for the customer to open the payment link checkout page.
                    description: Business data object containing the created payment link.
```
