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

# Create payment

> Initiate a new payment (limited to one-time): generate an invoice and charge it directly or with a checkout session



## OpenAPI

````yaml post /v1/payments
openapi: 3.1.0
info:
  title: Hyperline API
  version: 0.0.0
servers:
  - url: https://api.hyperline.co
  - url: https://sandbox.api.hyperline.co
security: []
paths:
  /v1/payments:
    post:
      tags:
        - Transactions
      summary: Create payment
      description: >-
        Initiate a new payment (limited to one-time): generate an invoice and
        charge it directly or with a checkout session
      operationId: createPayment
      requestBody:
        description: Create payment payload
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - one_time
                      description: >-

                        Payment type.


                        - `one_time`: One-time payment, generating one-off
                        invoice.
                          
                      example: one_time
                    customer_id:
                      type: string
                      description: ID of the customer the payment is collected from.
                      example: cus_Typ0px2W0aiEtl
                    items:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                            description: ID of the catalog product billed on the invoice.
                            example: itm_3kXODDF42QXtnL
                          name:
                            type: string
                            description: >-
                              Product name. Allow to override the value from the
                              catalog.
                            example: Product name
                          amount:
                            type: number
                            description: >-
                              Product unit amount. Allow to override the value
                              from the catalog. Monetary amount in currency's
                              smallest unit. Multiplied by `units_count` to get
                              the line item amount.
                          units_count:
                            type: integer
                            exclusiveMinimum: 0
                            default: 1
                            description: >-
                              Count of units of the product, as a positive
                              integer. The line item amount is the product unit
                              amount multiplied by this count.
                            example: 3
                        required:
                          - id
                      minItems: 1
                      deprecated: true
                      description: Deprecated field, please use `products`.
                    products:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                            description: ID of the catalog product billed on the invoice.
                            example: itm_3kXODDF42QXtnL
                          name:
                            type: string
                            description: >-
                              Product name. Allow to override the value from the
                              catalog.
                            example: Product name
                          amount:
                            type: number
                            description: >-
                              Product unit amount. Allow to override the value
                              from the catalog. Monetary amount in currency's
                              smallest unit. Multiplied by `units_count` to get
                              the line item amount.
                          units_count:
                            type: integer
                            exclusiveMinimum: 0
                            default: 1
                            description: >-
                              Count of units of the product, as a positive
                              integer. The line item amount is the product unit
                              amount multiplied by this count.
                            example: 3
                        required:
                          - id
                      minItems: 1
                      description: Products composing the related invoice.
                    purchase_order:
                      type: string
                      description: Purchase order added on the generated invoice.
                    custom_note:
                      type: string
                      description: Custom note added on the generated invoice.
                    coupons:
                      type: array
                      items:
                        anyOf:
                          - type: object
                            properties:
                              coupon_id:
                                type: string
                                description: >-
                                  ID of the catalog coupon to apply to the
                                  invoice.
                                example: cou_1eTaiytfA0i2Vb
                              name:
                                type: string
                                minLength: 1
                                description: Name of the coupon.
                                example: Black Friday 2026
                              discount_amount:
                                type: number
                                exclusiveMinimum: 0
                                description: >-
                                  Amount corresponding to the discounted part of
                                  the total amount.
                                example: 500
                              discount_percent:
                                type: number
                                exclusiveMinimum: 0
                                maximum: 100
                                description: >-
                                  Percentage overriding the catalog coupon
                                  value, applied to the eligible line items
                                  amount (excluding tax), between 0 (excluded)
                                  and 100. Cannot be combined with
                                  `discount_amount`.
                                example: 10
                              line_item_indexes:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: number
                                description: >-
                                  Index of the line items to which the coupon
                                  applies. Null means all line items.
                                example:
                                  - 0
                                  - 1
                            required:
                              - coupon_id
                            title: Coupon amount
                          - type: object
                            properties:
                              name:
                                type: string
                                minLength: 1
                                description: Name of the coupon.
                                example: Black Friday 2026
                              discount_amount:
                                type: number
                                exclusiveMinimum: 0
                                description: >-
                                  Amount corresponding to the discounted part of
                                  the total amount.
                                example: 500
                              line_item_indexes:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: number
                                description: >-
                                  Index of the line items to which the coupon
                                  applies. Null means all line items.
                                example:
                                  - 0
                                  - 1
                            required:
                              - discount_amount
                              - line_item_indexes
                            title: Inline coupon
                          - type: object
                            properties:
                              name:
                                type: string
                                minLength: 1
                                description: Name of the coupon.
                                example: Black Friday 2026
                              discount_percent:
                                type: number
                                exclusiveMinimum: 0
                                maximum: 100
                                description: >-
                                  Percentage of the eligible line items amount
                                  (excluding tax) to discount, between 0
                                  (excluded) and 100.
                                example: 10
                              line_item_indexes:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: number
                                description: >-
                                  Index of the line items to which the coupon
                                  applies. Null means all line items.
                                example:
                                  - 0
                                  - 1
                            required:
                              - discount_percent
                            additionalProperties: false
                            title: Inline percent coupon
                      description: >-
                        Coupons applied to the generated invoice before the
                        checkout is created, so the checkout email already shows
                        the discounted amount. `line_item_indexes` refer to the
                        position of the products in `products`. Only supported
                        with the `checkout` charging method.
                  required:
                    - type
                    - customer_id
                - anyOf:
                    - type: object
                      properties:
                        charging_method:
                          type: string
                          enum:
                            - immediately
                          description: >-

                            Charging method.


                            - `immediately`: Customer's payment method will be
                            charged directly to pay the invoice.

                            - `checkout`: Dedicated checkout page will be
                            created for the customer to pay the invoice.
                              
                        payment_method_type:
                          type: string
                          enum:
                            - transfer
                            - external
                          description: >-
                            Type of payment method to use to pay the invoice. If
                            not specified, the payment_method_id or the default
                            customer payment method is used.
                        payment_method_id:
                          type: string
                          description: >-
                            ID of the payment method to use to pay the invoice.
                            Ignored if payment_method_type is specified.
                          example: pm_1ryTrMj4TTAT1N
                      required:
                        - charging_method
                    - type: object
                      properties:
                        charging_method:
                          type: string
                          enum:
                            - checkout
                          description: >-

                            Charging method.


                            - `immediately`: Customer's payment method will be
                            charged directly to pay the invoice.

                            - `checkout`: Dedicated checkout page will be
                            created for the customer to pay the invoice.
                              
                        available_payment_methods:
                          type: array
                          items:
                            type: string
                            enum:
                              - card
                              - apple_pay
                              - google_pay
                              - direct_debit
                              - direct_debit_ach
                              - direct_debit_bacs
                              - stripe_link
                              - paypal
                              - transfer
                              - transfer_automated
                          minItems: 1
                        checkout_session:
                          type: object
                          properties:
                            send_to:
                              type: object
                              properties:
                                email:
                                  type: string
                                  format: email
                                customMessage:
                                  type: string
                              required:
                                - email
                              description: >-
                                Details to send email to the payer receiving the
                                checkout.
                            redirect_url:
                              type: string
                              format: uri
                              description: >-
                                URL to which Hyperline redirects the user after
                                the completion of the checkout.
                            cancelled_redirect_url:
                              type: string
                              format: uri
                              description: >-
                                URL to which Hyperline redirects the user
                                opening the checkout link once the checkout is
                                cancelled, instead of the expired checkout page.
                                Overrides the account-wide cancelled checkout
                                redirect URL. `checkout_id`, `customer_id` and
                                `invoice_id` are appended as query parameters.
                          description: Only applies to `checkout` charging method.
                      required:
                        - charging_method
                        - available_payment_methods
      responses:
        '200':
          description: The reference to the created invoice and optionally the checkout
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoice_id:
                    type: string
                    description: ID of the invoice created for the payment.
                  checkout:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Checkout session ID.
                      url:
                        type: string
                        description: >-
                          URL of the hosted Hyperline checkout page. Only
                          defined if the status is `opened`.
                    required:
                      - id
                      - url
                    description: Payment checkout session.
                required:
                  - invoice_id
      security:
        - bearer: []
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.