> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suave.money/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Payment Link



## OpenAPI

````yaml POST /api/v1/payment_link
openapi: 3.0.0
info:
  title: Suave API
  version: 0.0.1
servers:
  - url: https://checkout.suave.money
security: []
paths:
  /api/v1/payment_link:
    post:
      summary: Generates a new payment link for a customer to pay.
      parameters:
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
            example: your_api_key_here
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                line_items:
                  type: array
                  items:
                    $ref: '#/components/schemas/LineItem'
                order_price:
                  $ref: '#/components/schemas/OrderPrice'
                env_mode:
                  type: string
                  enum:
                    - test
                    - live
                  description: >-
                    Specify the `env_mode` to indicate the environment (e.g.,
                    `test` or `live`). On successful payment, webhook events are
                    sent to subscriptions with the same `env_mode` as the
                    payment link.
                  example: live
                success_callback_url:
                  type: string
                cancel_callback_url:
                  type: string
                failure_callback_url:
                  type: string
                metadata:
                  type: object
                  additionalProperties: true
              required:
                - success_callback_url
                - cancel_callback_url
                - failure_callback_url
                - line_items
                - order_price
                - env_mode
            example:
              line_items:
                - title: 'Acme NFT #1234'
                  description: >-
                    This Acme NFT is one of only 10000 in this collection. Your
                    Acme NFT gives you premium access to watch the Road Runner
                    evade Wile E. Coyote
                  quantity: 1
                  image_url: >-
                    https://www.artnews.com/wp-content/uploads/2022/01/unnamed-2.png
              order_price:
                amount: 1000000000000000000
                decimals: 18
                currency: USDC
              env_mode: live
              success_callback_url: http://localhost:3000?success=true
              cancel_callback_url: http://localhost:3000?cancel=true
              failure_callback_url: http://localhost:3000?failure=true
              metadata:
                custom_field: value
      responses:
        '200':
          description: A JSON object with payment order id and payment url
          content:
            application/json:
              schema:
                type: object
                properties:
                  payment_order_id:
                    type: string
                  payment_url:
                    type: string
              examples:
                Sample Response:
                  value:
                    payment_order_id: sample_payment_order_id
                    payment_url: >-
                      https://checkout.suave.money/payment/sample_payment_order_id
        '400':
          description: Invalid request data
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Invalid request data
                  code:
                    type: string
                    example: '400'
                  error:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                          example: success_callback_url
                        message:
                          type: string
                          example: Required
              example:
                message: Invalid request data
                code: '400'
                error:
                  - path: success_callback_url
                    message: Required
                  - path: cancel_callback_url
                    message: Required
                  - path: failure_callback_url
                    message: Required
                  - path: line_items
                    message: Required
                  - path: order_price
                    message: Required
      security:
        - apiKeyAuth: []
components:
  schemas:
    LineItem:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        image_url:
          type: string
        quantity:
          type: integer
      required:
        - title
        - quantity
    OrderPrice:
      type: object
      properties:
        currency:
          type: string
        amount:
          type: integer
        decimals:
          type: integer
      required:
        - currency
        - amount
        - decimals

````