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

# Close payment links



## OpenAPI

````yaml patch /payment-links/{id}/close
openapi: 3.0.0
info:
  title: Hub2 Service · Api
  description: |-
    This is the Hub2 api reference |
          Please check https://docs.hub2.io/ for the full documentation |
          Rate limits of endpoints are here : https://docs.hub2.io/en/details/limits.html.
  version: 2.149.1
  contact:
    name: Hub2
    url: https://www.hub2.io/
    email: contact@hub2.io
servers: []
security: []
tags:
  - name: Payments
    description: >-
      Best known as the PAY-IN API, it provides endpoints for merchants to
      perform Hub2 PAY-IN transactions.
  - name: Transfers
    description: >-
      Best known as the PAY-OUT API, it provides endpoints for merchants to
      perform Hub2 PAY-OUT transactions.
  - name: IRT
    description: International Remittance Transfers
  - name: Balance
    description: ''
  - name: Webhooks
    description: ''
  - name: Provisioning
    description: ''
  - name: Payment on Terminal
    description: ''
  - name: Receipt
    description: ''
  - name: Sms
    description: ''
  - name: Data
    description: ''
  - name: Compliance
    description: ''
  - name: Recipient
    description: ''
  - name: Delegation
    description: ''
  - name: Deposits
    description: ''
  - name: Payment Links
    description: ''
  - name: Submerchants
    description: ''
paths:
  /payment-links/{id}/close:
    patch:
      tags:
        - Payment Links
      operationId: PaymentLinksController_closePaymentLink
      parameters:
        - name: id
          required: true
          in: path
          description: Payment link ID
          schema:
            example: pl_z1urYtVFgEebtcj8fxp4v
            type: string
      responses:
        '200':
          description: Payment link closed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentLinkDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiBadRequestErrorAlias'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiForbiddenRequestErrorAlias'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiNotFoundErrorAlias'
        '429':
          description: 'ThrottlerException: Too Many Requests'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTooManyRequestErrorAlias'
components:
  schemas:
    PaymentLinkDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the payment link
          example: pl_z1urYtVFgEebtcj8fxp4v
        url:
          type: string
          description: URL for the payment link
          example: https://pay.hub2.com/pl_z1urYtVFgEebtcj8fxp4v
        status:
          type: string
          description: Current status of the payment link
          enum:
            - active
            - expired
            - closed
            - completed
          example: active
        purchaseReference:
          type: string
          description: Merchant reference for the payment
          example: ORDER-12345
        amount:
          type: object
          description: >-
            Amount intended to be charged in the smallest currency unit. Null
            when openAmount is true.
          example: 1000
          nullable: true
        openAmount:
          type: boolean
          description: When true, the payer decides the amount at payment time.
          example: false
        minAmount:
          type: number
          description: Minimum amount the payer can enter (only when openAmount is true).
          example: 500
        maxAmount:
          type: number
          description: Maximum amount the payer can enter (only when openAmount is true).
          example: 100000
        currency:
          type: string
          description: Three-letter ISO 4217 currency code
          example: XOF
        maximumPayments:
          type: number
          description: >-
            Maximum successful payments allowed (omitted when unlimited
            multi_use)
          example: 50
        currentSuccessCount:
          type: number
          description: Number of successful payments recorded for this link
          example: 0
        maximumAttempts:
          type: number
          description: Maximum number of failed payments allowed per user
          example: 3
        createdAt:
          type: string
          description: Creation date in ISO 8601 format
          example: '2024-01-15T12:00:00.000Z'
        updatedAt:
          type: string
          description: Last update date in ISO 8601 format
          example: '2024-01-15T12:30:00.000Z'
        expirationDate:
          type: string
          description: Expiration date in ISO 8601 format
          example: '2024-01-15T14:30:00.000Z'
        customerPhoneNumber:
          type: string
          description: Restricted MSISDN
          example: '123456789'
        type:
          type: string
          description: Type of the payment link
          enum:
            - single_use
            - multi_use
          example: single_use
        customerFields:
          description: >-
            Custom form fields defined on this payment link. Absent when the
            link has no customer fields.
          type: array
          items:
            $ref: '#/components/schemas/CustomerFieldDto'
        customerData:
          type: object
          additionalProperties:
            type: string
          description: >-
            Collected payer data as fieldName → value pairs. Absent when no
            customerFields are defined.
          example:
            national_id: AB123456
      required:
        - id
        - url
        - status
        - purchaseReference
        - amount
        - currency
        - currentSuccessCount
        - maximumAttempts
        - createdAt
        - updatedAt
        - expirationDate
        - customerPhoneNumber
        - type
    ApiBadRequestErrorAlias:
      type: object
      properties:
        status:
          type: number
          description: HTTP error code.
          example: 400
        error:
          description: HTTP error description.
          allOf:
            - $ref: '#/components/schemas/InternalApiBadRequestError'
      required:
        - status
        - error
    ApiForbiddenRequestErrorAlias:
      type: object
      properties:
        status:
          type: number
          description: status
          enum:
            - 403
          example: 403
        error:
          description: Error object
          allOf:
            - $ref: '#/components/schemas/ForbiddenErrorObject'
      required:
        - status
        - error
    ApiNotFoundErrorAlias:
      type: object
      properties:
        httpStatus:
          type: number
          description: Http status
          enum:
            - 404
          example: 404
        message:
          type: string
          description: Detailed error message which describe what happened.
          example: X not found
        error:
          type: string
          description: Error message
          example: Not found
      required:
        - httpStatus
        - message
        - error
    ApiTooManyRequestErrorAlias:
      type: object
      properties:
        status:
          type: number
          description: status
          enum:
            - 429
          example: 429
        error:
          type: string
          description: Error
          example: 'ThrottlerException: Too Many Requests'
      required:
        - status
        - error
    CustomerFieldDto:
      type: object
      properties:
        fieldName:
          type: string
          description: Field identifier in snake_case
          example: national_id
        fieldLabel:
          type: string
          description: Human-readable label shown to the payer
          example: National ID
          maxLength: 100
        fieldPlaceholder:
          type: string
          description: Optional input placeholder text
          maxLength: 200
        fieldType:
          type: string
          enum:
            - text
            - integer
            - decimal
            - email
            - date
          description: Expected value type for validation and input rendering
        isRequired:
          type: boolean
          description: Whether the payer must fill this field before proceeding
      required:
        - fieldName
        - fieldLabel
        - fieldType
        - isRequired
    InternalApiBadRequestError:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP error code.
          example: 400
        message:
          description: >-
            Detailed error message or array of messages to describe what's
            wrong.
          example:
            - destination.provider must be a string
          type: array
          items:
            type: string
        error:
          type: string
          description: The error message
          example: Bad Request
      required:
        - statusCode
        - message
        - error
    ForbiddenErrorObject:
      type: object
      properties:
        statusCode:
          type: number
          description: Http status
          enum:
            - 403
          example: 403
        message:
          type: string
          description: Detailed error message
          example: Forbidden
        error:
          type: string
          description: Error name
      required:
        - statusCode
        - message
        - error

````