# Get payment link details

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/merchant-portal/merchant-access/payment-link/detail:
    post:
      summary: Get payment link details
      deprecated: false
      description: >-
        This API allows you to retrieve the details of a payment link that has
        already been created.
      tags:
        - Payment Link
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                request_time:
                  type: string
                  description: Request date and time in UTC format as YYYYMMDDHHmmss.
                merchant_id:
                  type: string
                  description: A unique merchant key provided by ABA Bank.
                merchant_auth:
                  type: string
                  description: >-
                    A JSON string representing a JSON object, encrypted using
                    OpenSSL with an RSA public key.


                    **PHP Sample Code**


                    ```php

                    function opensslEncryption($source, $publicKey)

                    {
                        $maxlength = 117;
                        $output = '';
                        while (!empty($source)) {
                            $input = substr($source, 0, $maxlength);
                            openssl_public_encrypt($input, $encrypted, $publicKey);
                            $output .= $encrypted;
                            $source = substr($source, $maxlength);
                        }
                        return base64_encode($output);
                    }

                    $merchantAuth = json_encode([
                        "mc_id" => $merchant_id,
                        "id":"hEbr4***xQbpGQ=="
                    ]);

                    $rsaPublicKey = "RSA PUBLIC KEY PROVIDED BY ABA BANK";

                    $merchantAuthEnc = opensslEncryption($merchantAuth,
                    $rsaPublicKey);

                    ```
                hash:
                  type: string
                  description: >-
                    Base64-encoded HMAC SHA-512 hash of the concatenated values:
                    `request_time`,  `merchant_id`, and  `merchant_auth` with
                    `public_key`.


                    **PHP Sample Code**


                    ```php

                    // public key provided by ABA Bank

                    $api_key = "API KEY PROVIDED BY ABA BANK";


                    // Prepare the data for hashing

                    $b4hash = $request_time . $merchant_id . $merchant_auth;


                    // Generate the HMAC hash using SHA-512 and encode it in
                    Base64

                    $hash = base64_encode(hash_hmac('sha512', $b4hash, $api_key,
                    true));

                    ```
              x-apidog-orders:
                - request_time
                - merchant_id
                - merchant_auth
                - hash
              required:
                - request_time
                - merchant_id
                - merchant_auth
                - hash
            example:
              request_time: '20200728093403'
              merchant_id: ec000002
              merchant_auth: 39aaa43e6929a752.....08cdb29ab498d9604600101d8dc00a
              hash: EVDFA2118UD0...fbMa2b5q9CCt+sWw==
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: >-
                          A unique payment link ID generated by the payment
                          gateway.
                      title:
                        type: string
                        description: The title of your payment link.
                      image:
                        type: object
                        properties:
                          image:
                            type: string
                            description: Full URL of the image
                          filename:
                            type: string
                            description: >-
                              The filename of the image, including its
                              extension.
                          size:
                            type: number
                            description: Image size in KB
                        x-apidog-orders:
                          - image
                          - filename
                          - size
                        description: Image associated with the payment link
                      amount:
                        type: number
                        description: Payment link amount.
                      currency:
                        type: string
                        description: 'Payment link currency. Supported values: `KHR`, `USD`.'
                        maxLength: 3
                        minLength: 3
                      status:
                        type: string
                        description: >-
                          Status of the payment link:


                          - **`OPEN`**: The status remains open when
                          `payment_limit` is greater than `total_trxn`, meaning
                          payments can still be made.  

                          - **`PAID`**: The status changes to paid once
                          `payment_limit` equals `total_trxn`. At this point,
                          the user can no longer make payments using the
                          **`PAID`** payment link.
                      payment_limit:
                        type: number
                        description: >-
                          The maximum number of transactions allowed for this
                          payment link.
                      total_amount:
                        type: number
                        description: Total amount after refund.
                      total_trxn:
                        type: number
                        description: >-
                          The total number of completed payment transactions. A
                          newly created payment link will have a value of 0
                      created_at:
                        type: string
                        description: >-
                          Date and time when the payment link was created in the
                          payment gateway.
                      updated_at:
                        type: string
                        description: The last updated date and time of the payment link.
                      expired_date:
                        type: number
                        description: The expiration timestamp for this payment link.
                      pushback_url:
                        type: string
                        description: >-
                          The URL that the payment gateway will call to send
                          payment status updates.
                      payment_link:
                        type: string
                        description: >-
                          A unique payment link url generated by the payment
                          gateway.
                      description:
                        type: string
                        description: A description of your payment link.
                      total_amount_org:
                        type: string
                        description: Total payment amount before refund.
                      total_refund:
                        type: string
                        description: >-
                          Total of refund amount of all lated transaction of the
                          payment link.
                    x-apidog-orders:
                      - id
                      - title
                      - image
                      - amount
                      - currency
                      - status
                      - description
                      - payment_limit
                      - total_amount_org
                      - total_refund
                      - total_amount
                      - total_trxn
                      - created_at
                      - updated_at
                      - expired_date
                      - pushback_url
                      - payment_link
                    required:
                      - id
                      - amount
                      - updated_at
                      - created_at
                      - total_trxn
                      - total_amount
                      - payment_limit
                      - status
                      - currency
                      - expired_date
                      - description
                      - total_amount_org
                      - total_refund
                  status:
                    type: object
                    properties:
                      code:
                        type: string
                        description: |-
                          - `PTL02` : Wrong hash
                          - `PTL132` :  Invalid payment link
                      message:
                        type: string
                        description: >-
                          Please see the property reponse `code` for the
                          details.
                    x-apidog-orders:
                      - code
                      - message
                    required:
                      - code
                      - message
                  tran_id:
                    type: string
                    description: A unique log ID generated by the payment gateway.
                x-apidog-orders:
                  - data
                  - status
                  - tran_id
                required:
                  - data
                  - status
                  - tran_id
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: Payment Link
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/831852/apis/api-14530838-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://checkout-sandbox.payway.com.kh/
    description: StillZeroBug
security: []

```
