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

# Deactivate Payment Link

> Close an active payment link so it takes no further payment. A deactivated link reads expired.

## Overview

Closes an active payment link so the buyer can no longer pay through it. The call takes no body, and a successful one returns an empty `data`:

```json theme={null}
{
  "success": true,
  "message": "Payment Link deactivated successfully",
  "data": {}
}
```

## Path Parameters

* `link_id`: The link's ID from [Create Payment Link](/api-reference/v3/payment-link/create), e.g. `PR4829301756`. The `payment_id` it returned is the same value.

<Note>
  **PSPs send `X-Merchant-ID`** naming the sub-merchant the link belongs to, as on [Create Payment Link](/api-reference/v3/payment-link/create).
</Note>

## What deactivation does

* **The link reads `expired`.** There is no separate deactivated status: deactivating sets `expiry_date` to the moment of the call, so [Retrieve Payment Link](/api-reference/v3/payment-link/retrieve) and [List Payment Links](/api-reference/v3/payment-link/list) report it as `expired`, with that moment as its `expiry_date`.
* **It cannot be undone.** To collect again, create a new link with a new `reference_id`.
* **A payment already underway can still land.** If the buyer was mid-payment when you deactivated, check the link afterwards: `paid` outranks `expired`, so a link whose payment went through reads `paid`.

## When it is refused

Only an `active` link can be deactivated. A link that is already `paid`, `expired` (deactivated links included) or `failed` is refused with a `400`, so deactivating a link twice fails the second time:

```json theme={null}
{
  "success": false,
  "error": {
    "code": "ERR_ORDER_002",
    "message": "Validation error",
    "details": {
      "payment": "Payment Link cannot be deactivated"
    }
  }
}
```

## Errors

| Status | `error.code`                                 | When                                                                | `details`                                                                                     |
| ------ | -------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `400`  | `ERR_ORDER_002`                              | The link is not `active`                                            | `{"payment": "Payment Link cannot be deactivated"}`                                           |
| `401`  | `ERR_AUTH_000`, `ERR_AUTH_001`               | Credentials are missing or wrong, or a PSP left out `X-Merchant-ID` | `{"authentication": "X-Merchant-ID header is required for this endpoint."}`                   |
| `403`  | —                                            | Payment links are not enabled on your account                       | Not the standard envelope: `{"detail": "You do not have permission to perform this action."}` |
| `403`  | `ERR_SERVICE_ERROR_000`                      | Your account is not configured to collect through payment links     | e.g. `{"payment_gateway": "Payment gateway not configured"}`                                  |
| `429`  | `ERR_RATE_LIMIT_EXCEEDED`                    | The payment network is rate limiting requests                       | Retry after the `Retry-After` header, when it is sent                                         |
| `502`  | `ERR_GATEWAY_UNAVAILABLE`, `ERR_PAYMENT_003` | The payment network could not be reached, or returned an error      | Retry shortly                                                                                 |
| `500`  | `ERR_SERVICE_ERROR_000`                      | Anything unexpected                                                 | `{"error": "An unexpected error occurred. Please try again later"}`                           |


## OpenAPI

````yaml openapi/v3-payment-links.json POST /pg/payment-links/{link_id}/deactivate/
openapi: 3.0.0
info:
  title: EximPe Payment Gateway API — v3 Payment Links
  description: >-
    Create, list, retrieve and deactivate payment links on the v3 API. v1 and v2
    use the same paths; this spec carries the v3 contract.
  version: 3.0.0
servers:
  - url: https://api-pacb-uat.eximpe.com
    description: Payment Gateway Sandbox URL
security: []
paths:
  /pg/payment-links/{link_id}/deactivate/:
    post:
      tags:
        - Payment Links
      summary: Deactivate Payment Link
      description: >-
        Close an active payment link so it takes no further payment. A
        deactivated link reads expired.
      operationId: v3_deactivatePaymentLink
      parameters:
        - name: link_id
          in: path
          required: true
          description: >-
            The link's `link_id`, as returned by Create Payment Link (`PR`
            followed by 10 digits). The `payment_id` Create Payment Link returns
            is the same value.
          schema:
            type: string
            example: PR4829301756
      responses:
        '200':
          description: Payment link deactivated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_DeactivatePaymentLinkResponse'
              examples:
                Deactivated:
                  summary: Deactivated
                  value:
                    success: true
                    message: Payment Link deactivated successfully
                    data: {}
        '400':
          description: The link is already paid, expired, deactivated or failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              examples:
                Link cannot be deactivated:
                  summary: Link cannot be deactivated
                  value:
                    success: false
                    error:
                      code: ERR_ORDER_002
                      message: Validation error
                      details:
                        payment: Payment Link cannot be deactivated
        '401':
          description: Missing or invalid credentials, or a PSP call without X-Merchant-ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              examples:
                Invalid credentials:
                  summary: Invalid credentials
                  value:
                    success: false
                    error:
                      code: ERR_AUTH_001
                      message: Invalid credentials
                      details:
                        authentication: Invalid credentials.
                X-Merchant-ID missing:
                  summary: X-Merchant-ID missing (PSP)
                  description: A PSP must name the sub-merchant the link belongs to.
                  value:
                    success: false
                    error:
                      code: ERR_AUTH_000
                      message: Missing credentials
                      details:
                        authentication: X-Merchant-ID header is required for this endpoint.
        '403':
          description: >-
            Payment links are not enabled on the account, or it is not set up
            for them
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/v3_PermissionDeniedResponse'
                  - $ref: '#/components/schemas/v3_ErrorResponse'
              examples:
                Payment links not enabled:
                  summary: Payment links not enabled
                  description: >-
                    Payment links are not enabled on the account. This body does
                    not use the standard error envelope.
                  value:
                    detail: You do not have permission to perform this action.
                Account not set up:
                  summary: Account not set up for payment links
                  description: >-
                    The account is not configured to collect through payment
                    links. Contact your EximPe integration manager.
                  value:
                    success: false
                    error:
                      code: ERR_SERVICE_ERROR_000
                      message: Payment gateway error
                      details:
                        payment_gateway: Payment gateway not configured
        '429':
          description: The payment network is rate limiting requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying. Not always present.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              examples:
                Rate limited:
                  summary: Rate limited
                  description: >-
                    Wait for the number of seconds in the Retry-After header,
                    when it is present, then retry.
                  value:
                    success: false
                    error:
                      code: ERR_RATE_LIMIT_EXCEEDED
                      message: Too many requests. Please try again later.
                      details:
                        message: >-
                          Too many requests have been made in a short period, so
                          the request was rate limited. Please wait a moment and
                          try again.
                        path: /pg/payment-links/
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              examples:
                Unexpected error:
                  summary: Unexpected error
                  value:
                    success: false
                    error:
                      code: ERR_SERVICE_ERROR_000
                      message: Payment gateway error
                      details:
                        error: An unexpected error occurred. Please try again later
        '502':
          description: The payment network is temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              examples:
                Temporarily unavailable:
                  summary: Temporarily unavailable
                  value:
                    success: false
                    error:
                      code: ERR_GATEWAY_UNAVAILABLE
                      message: Payment gateway temporarily unavailable
                      details:
                        message: >-
                          We couldn't reach the payment provider. Please try
                          again shortly.
      security:
        - clientAuth: []
          clientSecretAuth: []
          merchantAuth: []
          apiVersionHeader: []
components:
  schemas:
    v3_DeactivatePaymentLinkResponse:
      type: object
      required:
        - success
        - message
        - data
      properties:
        success:
          type: boolean
          description: Indicates if the request was successful
        message:
          type: string
          description: Response message
        data:
          type: object
          description: Always empty
          properties: {}
    v3_ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Indicates if the request was successful. Always false for error
            responses.
        error:
          $ref: '#/components/schemas/v3_ErrorDetails'
    v3_PermissionDeniedResponse:
      type: object
      required:
        - detail
      description: >-
        Returned when payment links are not enabled on the account. It does not
        use the standard error envelope.
      properties:
        detail:
          type: string
          description: Why the request was refused
    v3_ErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          description: >-
            Error code (e.g., ERR_ORDER_002). The list endpoint's own failure
            sends a number (40350).
          oneOf:
            - type: string
            - type: integer
        message:
          type: string
          description: Error message
        details:
          description: >-
            What failed. Usually an object keyed by the offending field and
            nested the way the request is (e.g. buyer.address.postal_code), with
            one message per field. A purpose_code refusal sends a single string
            instead.
          oneOf:
            - type: object
              additionalProperties: true
            - type: string
  securitySchemes:
    clientAuth:
      type: apiKey
      name: X-Client-ID
      in: header
      description: >-
        **Client Application ID** - Your unique application identifier used to
        authenticate API requests. You can find your Client ID in the Developer
        Settings section of the merchant dashboard.
      x-displayName: Client ID
      x-example: your-client-id
    clientSecretAuth:
      type: apiKey
      name: X-Client-Secret
      in: header
      description: >-
        **Client Secret Key** - Your secret key used alongside the Client ID for
        secure authentication. Keep this confidential and never expose it in
        client-side code. Available in the Developer Settings section of the
        merchant dashboard.
      x-displayName: Client Secret
      x-example: your-client-secret
    merchantAuth:
      type: apiKey
      name: X-Merchant-ID
      in: header
      description: >-
        **Merchant Identifier** - The unique ID for the merchant account. This
        is required for PSP (Payment Service Provider) merchants who manage
        multiple merchant accounts. You can find merchant IDs in the Merchant
        Management section of the dashboard.
      x-displayName: Merchant ID
      x-example: your-merchant-id
    apiVersionHeader:
      type: apiKey
      name: X-API-Version
      in: header
      description: >-
        **API Version** - Specifies which version of the API to use (e.g.,
        '1.X.X', '2.X.X', or '3.X.X'). This header allows you to control which
        API version your integration uses. Default version information is
        available in the Developer Settings.
      x-displayName: API Version
      x-example: 3.0.0

````