swagger: "2.0"
schemes:
  - https
host: sandbox.mastercard.com
info:
  description: The Payment Account Reference Inquiry API is the unified Mastercard interface for allowing Mastercard Customers involved in payment card acceptance -- whether Merchants, Acquirers, or Digital Activity Customers (DACs) -- to enquire the PAR Vault for getting the PAR, when providing an Account Primary Account Number (PAN) linked to a digitized PAN.
  title: Payment Account Reference Inquiry API
  version: "1.1"
  x-artifactId: par-api-inbound
  x-origin:
    - format: swagger
      url: https://developer.mastercard.com/devzone/api/portal/swagger/payment-account-reference-inquiry
      version: "2.0"
  x-providerName: mastercard.com
  x-serviceName: PaymentAccountReferenceInquiryAPI
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_apis.guru_assets_images_no-logo.svg
consumes:
  - application/json
produces:
  - application/json
paths:
  /par/paymentaccountreference/1/0/getPaymentAccountReference:
    post:
      description: |
        The API performs a PAR query into the PAR Vault with the supplied PAN. When a PAR is returned from the PAR vault the API will encrypt it using the wrapped encryption method with the 
        Mastercard Customer?s Encryption Public Key and include it in the API response.
      parameters:
        - description: Contains the details of the get PAR API request message.
          in: body
          name: getPaymentAccountReferenceRequestSchema
          schema:
            $ref: "#/definitions/getPaymentAccountReferenceRequestSchema"
      responses:
        "200":
          description: Contains the details of the get PAR API response message.
          schema:
            $ref: "#/definitions/getPaymentAccountReferenceResponseSchema"
      summary: Submit an encrypted PAN to obtain the PAR linked to the account.
      tags:
        - Get Payment Account Reference
      x-testable: yes
definitions:
  encryptedPayloadData:
    properties:
      encryptedData:
        description: |
          Encrypted payload that contains the Primary Account Number (PAN). Refer to Encrypted Data Objects section for the format of encrypted data or download the latest OpenAPI YAML 
          specification.
          __Max length:__ 256k  
          __Type:__ String Hex-encoded Data (case-insensitive)
          </br> </br> 
        example: 4ca442de53910ea8f29602a749a51da64913b5c1b167b798c18e36ddaa05a6ba6619fdd7e8cecc249d93c31217e83e8f
        type: string
      encryptedKey:
        description: |
          One-time use AES key encrypted by the MasterCard public key (as identified by 'publicKeyFingerprint') using the OAEP or RSA Encryption Standard PKCS 1 v1.5 (depending on the value of 
          'oaepHashingAlgorithm'). Requirement is for a 128-bit key (with 256-bit key supported as an option). 
          </br><br>
          __Data Type:__ String. Hex-encoded data (case-insensitive).<br> 
          __Max Length:__ 512
          </br></br>
        example: a207fc78e0dbf4d4daab90aefe7058bb846f345e1c4ac3af5536a7cf93591a05e2e0ea5b1a23835a0954e8303addaeb4fa0abb78e3586a3523343dbedea05381c012864433dbac25106fedb061c85c5a8ac9ea60be497c82ba236fe54c83744b3f0d1825222e0a320c277900b528cb0f093e724ef8c0626d53c273b7c81b70458819251e4fc7cb065072bf034796f7d1a911c2e2bfd0cf208036dda0b18a39eee66de04df8a22b26cd00e235de300f25f9c4cf7cb120212dbce5ad93ae65721c21902d3ae7d9d6904814e76cc5c6e92ea132c6cbd4ab835167601cef01f9d915a1f7b5bca117ef321118acabbdd6d02760ced68fcb2c4d6d7e7c558b0f23a07e
        type: string
      iv:
        description: |
          The initialization vector used when encrypting data using the one-time use AES key. Must be exactly 16 bytes (32 character hex string) to match the block size. If not present, an IV of zero is assumed.<br><br> 
          __Length:__ 32 (exactly)<br>
          __Type:__ String Hex-encoded Data (case-insensitive).<br><br>
        example: 91f86d9252849db2538f4224c4816433
        type: string
      oaepHashingAlgorithm:
        description: |
          Hashing algorithm used with the OAEP scheme. If omitted, then the RSA Encryption Standard PKCS 1 v1.5 will be used. You must use one of the following algorithms; SHA256 - Use the SHA- 
          256 algorithm | SHA512 - Use the SHA-512 algorithm.<br><br>  
           __Max length:__ 6<br> 
          __Type:__ String
        example: SHA256
        type: string
      publicKeyFingerprint:
        description: |
          The fingerprint of the public key used to encrypt the ephemeral AES key. Max length - 64. Type - String Hex-encoded Data (case-insensitive).
        example: 4c4ead5927f0df8117f178eea9308daa58e27c2b
        type: string
  encryptedPayloadOut:
    properties:
      encryptedData:
        description: Contains an encrypted JSON object. Encrypted by the ephemeral AES key using CBC mode (IV as provided in 'iv', or zero if none provided) and PKCS#7 padding. The JSON object being encrypted will be defined in the context of the API call. Max length - 256k.  Type - String Hex-encoded Data (case-insensitive). Required - Yes.
        example: 4545433044323232363739304532433610DE1D1461475BEB6D815F31764DDC20298BD779FBE37EE5AB3CBDA9F9825E1DDE321469537FE461E824AA55BA67BF6A
        type: string
      encryptedKey:
        description: One-time use AES key encrypted by the MasterCard public key (as identified by 'publicKeyFingerprint') using the OAEP or RSA Encryption Standard PKCS 1 v1.5 (depending on the value of 'oaepHashingAlgorithm'). Requirement is for a 128-bit key (with 256-bit key supported as an option). Data Type - String. Hex-encoded data (case-insensitive). Max Length - 512. Required - Yes.
        example: A1B2C3D4E5F6112233445566
        type: string
      iv:
        description: The initialization vector used when encrypting data using the one-time use AES key. Must be exactly 16 bytes (32 character hex string) to match the block size. If not present, an IV of zero is assumed. Length - 32 exactly. Type - String Hex-encoded Data (case-insensitive). Optional.
        example: "31323334353637383930313233343536"
        type: string
      oaepHashingAlgorithm:
        description: Hashing algorithm used with the OAEP scheme. If omitted, then the RSA Encryption Standard PKCS 1 v1.5 will be used. You must use one of the following algorithms; SHA256 - Use the SHA-256 algorithm | SHA512 - Use the SHA-512 algorithm.  Max length - 6. Type - String. Optional.
        example: SHA512
        type: string
      publicKeyFingerprint:
        description: |
          The fingerprint of the public key used to encrypt the ephemeral AES key. <br><br>
          __Max length:__ 64 
          __Type:__ String Hex-encoded Data (case-insensitive)<br><br>
        example: 4c4ead5927f0df8117f178eea9308daa58e27c2b
        type: string
    required:
      - publicKeyFingerprint
      - encryptedKey
      - encryptedData
  getPaymentAccountReferenceRequestSchema:
    properties:
      encryptedPayload:
        $ref: "#/definitions/encryptedPayloadData"
      requestId:
        description: The id of the request submitted.
        example: "123456"
        type: string
    required:
      - requestId
      - encryptedPayload
  getPaymentAccountReferenceResponseSchema:
    properties:
      encryptedPayload:
        $ref: "#/definitions/encryptedPayloadOut"
        description: Contains the API response encrypted object.  Data Type - EncryptedPayload object containing a PaymentAccountReferencePayload object. Max Length - N/A. Required - Yes.
      responseId:
        description: The id of the response sent. Required.
        example: "123456"
        type: string
