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

# Check payment status

> Retrieves the current state of a transaction.

Call this after the customer is redirected back to your site, and **before** fulfilling
any order. A redirect to your `success_url` does not by itself confirm that funds were
collected — only a `paymentStatus` of `CAPTURED` does.

Also use this endpoint for reconciliation and to confirm the outcome of a refund.




## OpenAPI

````yaml /openapi.yaml post /ws/paymentgateway/get-payment-details
openapi: 3.1.0
info:
  title: Payzah Payment Gateway API
  version: 1.0.0
  description: >
    Accept K-Net, VISA, MasterCard, and Apple Pay payments in Kuwait.


    Every endpoint is a `POST` request with a JSON body. Authenticate by sending
    your

    Base64-encoded private key in the `Authorization` header.


    **All requests must be made server-side.** Never expose your private key in

    client-side code, mobile app binaries, or public repositories.


    ## Testing from these docs


    The interactive console below is pointed at the **test environment only**

    (`https://development.payzah.net`). Requests you send from this page create
    real

    sandbox transactions, but no real money moves.


    Use your **test** API key and the [sandbox test
    cards](/guides/test-credentials).

    Production endpoints are deliberately excluded here — switch your base URL
    to

    production only from your own server code, once your integration is fully
    validated.
  contact:
    name: Payzah Support
    email: Info@payzah.com
    url: https://payzah.com
  x-logo:
    altText: Payzah
servers:
  - url: https://development.payzah.net
    description: Test environment (sandbox)
security:
  - PrivateKeyAuth: []
tags:
  - name: Payments
    description: Create payment sessions and check their outcome.
  - name: Refunds
    description: Return funds to a customer for a completed transaction.
paths:
  /ws/paymentgateway/get-payment-details:
    post:
      tags:
        - Payments
      summary: Check payment status
      description: >
        Retrieves the current state of a transaction.


        Call this after the customer is redirected back to your site, and
        **before** fulfilling

        any order. A redirect to your `success_url` does not by itself confirm
        that funds were

        collected — only a `paymentStatus` of `CAPTURED` does.


        Also use this endpoint for reconciliation and to confirm the outcome of
        a refund.
      operationId: getPaymentDetails
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentDetailsRequest'
            examples:
              default:
                summary: Look up a transaction
                value:
                  trackid: '1000'
                  payment_id: '2023020818520981564303'
      responses:
        '200':
          description: >
            Always returned with HTTP 200. Check the `status` field to determine
            success or failure.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PaymentDetailsSuccess'
                  - $ref: '#/components/schemas/ErrorResponse'
              examples:
                success:
                  summary: Transaction found
                  value:
                    status: true
                    data:
                      payzahRefrenceCode: '2023020818520981564303'
                      trackId: '1000'
                      UDF1: ''
                      UDF2: ''
                      UDF3: ''
                      UDF4: ''
                      UDF5: ''
                      knetPaymentId: '100202303935749373'
                      paymentId: '100202303935749373'
                      transactionNumber: '202303935759799'
                      trackingNumber: '12992052519157'
                      paymentDate: 2023-02-08 18 52 09
                      paymentStatus: CAPTURED
                error:
                  summary: No matching record
                  value:
                    status: false
                    message: No Record found for the provided details
                    code: 10012
components:
  schemas:
    PaymentDetailsRequest:
      type: object
      required:
        - trackid
        - payment_id
      properties:
        trackid:
          type: string
          maxLength: 255
          description: The Track ID you submitted in the original initialization request.
          example: '1000'
        payment_id:
          type: string
          maxLength: 255
          description: >-
            The `PaymentID` Payzah returned in the initialization response. Not
            your own order ID.
          example: '2023020818520981564303'
    PaymentDetailsSuccess:
      type: object
      properties:
        status:
          type: boolean
          const: true
          description: '`true` when a matching payment record was found.'
          example: true
        data:
          type: object
          properties:
            payzahRefrenceCode:
              type: string
              description: >-
                Payzah's reference code for this payment. Use this value as
                `refrence_code` when issuing a refund.
            trackId:
              type: string
              description: The Track ID you submitted during initialization.
            UDF1:
              type: string
              description: User-defined field 1 as submitted. Empty string if not provided.
            UDF2:
              type: string
              description: User-defined field 2. Empty string if not provided.
            UDF3:
              type: string
              description: User-defined field 3. Empty string if not provided.
            UDF4:
              type: string
              description: User-defined field 4. Empty string if not provided.
            UDF5:
              type: string
              description: User-defined field 5. Empty string if not provided.
            knetPaymentId:
              type: string
              description: Payment ID assigned by the K-Net network.
            paymentId:
              type: string
              description: >-
                Payment ID assigned by the processor. Matches `knetPaymentId`
                for K-Net transactions.
            transactionNumber:
              type: string
              description: Unique transaction number generated by the payment network.
            trackingNumber:
              type: string
              description: Network tracking number, used for bank reconciliation.
            paymentDate:
              type: string
              description: Date and time the payment was processed.
            paymentStatus:
              type: string
              enum:
                - CAPTURED
                - NOT CAPTURED
                - VOIDED
                - CANCELED
                - DENIED BY RISK
                - HOST TIMEOUT
              description: >
                Current state of the transaction. Only fulfil an order when this
                is `CAPTURED`.


                | Status | Meaning |

                | --- | --- |

                | `CAPTURED` | Authorized and captured. Funds secured. |

                | `NOT CAPTURED` | Authorized but not captured. Investigate
                before acting. |

                | `VOIDED` | Voided after authorization. No funds captured. |

                | `CANCELED` | Customer cancelled before completing payment. |

                | `DENIED BY RISK` | Blocked by risk controls. Do not retry
                automatically. |

                | `HOST TIMEOUT` | Host did not respond. Outcome uncertain —
                confirm manually. |
    ErrorResponse:
      type: object
      properties:
        status:
          type: boolean
          const: false
          description: '`false` when the request failed. Always check this field.'
          example: false
        message:
          type: string
          description: Human-readable description of the error.
          example: No Record found for the provided details
        code:
          description: >
            Numeric error code. See the Response Codes reference for the full
            list of codes 10000–10015.


            Commonly returned values:


            | Code | Meaning |

            | --- | --- |

            | `10001` | `trackid` contains invalid characters |

            | `10002` | `trackid` missing |

            | `10003` | `amount` malformed |

            | `10004` | `amount` missing |

            | `10005` | `success_url` missing |

            | `10006` | `error_url` missing |

            | `10012` | No record found for the provided details |

            | `10013` | Request body empty or not JSON |

            | `10014` | Invalid Authorization token |

            | `10015` | Account not permitted to use Credit Card direct
            integration |
          oneOf:
            - type: string
            - type: integer
          example: 10012
  securitySchemes:
    PrivateKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >
        Your private key, Base64-encoded.


        Encode the key before sending it — for example
        `base64_encode($privateKey)` in PHP or

        `Buffer.from(privateKey).toString('base64')` in Node.js. Paste the
        **already-encoded**

        value here when testing from these docs.


        **Use your test key here.** This console only calls the sandbox
        environment,

        so a production key will not authenticate.

````