Navigation: 5. PAYMENT MANAGEMENT AND PROCESSING >

The Query Payment API Call

 

 

 

 

 

This call is used to discover the status of a previously executed purchase request. Typically, this call is made when a merchant or PSP queries the final outcome of a payment.

 

URLs:          

 

Test

 https://api.test.oneroadpayments.com/merchants/{merchantID}/transactions/{orderID} 

Production

 https://api.oneroadpayments.com/merchants/{merchantID}/transactions/{orderID} 

 

Request Method:          

 

GET

 

Headers:

 

 

The header ‘x-api-key’ should be set to the value of the Merchant API Key allocated to the merchant or PSP at sign up.

 

 

 

URL Parameters:

 

Name

Description

M/O

merchantID

The unique merchant ID provided by the PSP or allocated by the MYGW system

M

orderID

The order ID provided with the payment request which uniquely identifies a payment

M

 

Body-  Query Payment Request

 

NA- No body data required.

 

The query payment request should be sent to the MYGW server using the GET method.

 

Body – Query Payment Response

 

The MYGW server will respond including a status code, signifying whether the call succeeded, as described above - MYGW API Responses.

 

An example of the JSON object sent in a response to a successful query payment request is as follows.

 

{

"response":{

    "statusCode":200,

    "message":"OK"

    },

"reply":

    {

    "amount":"25.00",

    "balance":"25.00",

    "clientID":"TheClient",

    "currency":"USD",

    "date":"2024-07-16T06:20:53.281",

    "detail":"Successfully completed",

    "merchant":"The Merchant",

    "merchantID":"5adeaafb-1b6d-4bb2-ba11-1cce35e6b38e",

    "orderID":"110836419",

    "reason":"Success!",

    "result":"0",

    "settlement":"2024-07-23",

    "signature":"3a53e1e7251b08036cc2f9b8de9d2030",

    "success":"Y",

    "url":"https://www.oneroadpayments.com/ReturnURL.html?currency=AUD&success=Y&merchantID=5adeaafb-1b6d-4bb2-ba11-1cce35e6b38e&orderID=110836419&clientID=NewClient&amount=25.00&signature=3a53e1e7251b08036cc2f9b8de9d2030"

    }

}

 

The details of the response are in the following table, M means a value that is always returned with a successful query payment response; and O means a value which may be returned depending on the status of the original payment request.

 

Name

Description

M/O

clientID

Identifies the client who performed the original payment transaction

O

amount

The amount of the purchase transaction

M

balance

The amount still pending settlement to the merchant

O

currency

The transaction currency for the original payment transaction

M

date

The date on which the original payment transaction was completed

O

orderID

The unique merchant order number for the original transaction

M

URL

Details of the callback URL performed for this transaction

O

merchant

The name of the merchant as stored with the gateway

O

merchantID

The unique merchant ID provided by the PSP or allocated by the MYGW system

M

detail

More information on the status of the payment transaction

O

reason

More information on the status of the payment transaction

O

result

A numeric identifier which denotes the final result of the transaction, can be one of the values shown below

O

settlement

If the payment transaction completed successfully, this is the date on which the funds will be transferred to the merchant

O

signature

The cryptographic hash for the payment transaction results, created using the Merchant Key, calculated as described above under Callback URL Processing

M

 

The value of the result field can be one of the following, the meanings of which have been described above.

 

0 – Transaction completed successfully

1 – Transaction pending, incomplete

2 – Signature mismatch

4 – Client record not found

5 – Duplicate order identifier

7 – Unable to determine the gateway processor

9 – Transaction declined, the transaction was declined by the account or card issuer

10 – Amount out of range for this merchant

11 – Transaction abandoned, the transaction was not completed within the timeout period

15 – Currency not supported for this merchant

17 – Blocked due to risk score

 

An example of the JSON object sent in a response to an unsuccessful query payment request is as follows.

 

{

"response":

{

"statusCode": 404,

"message": " "Not Found",

"detail": " No OrderID found with MerchantID: 5adeaafb-1b6d-4bb2-ba11-1cce35e6b38e"

}

}

 

The status code and status message returned could be one of the following values.

 

Status Code

Description

Status Message

200

The query payment result was successfully returned from the server

Message - OK

400

The request URL was incorrectly formatted

Message - Bad request

Detail – Bad parameters

403

The merchant API key could not be validated, and the request failed

Message - Forbidden

404

No order with the ID specified was found for the merchant at the server

Message – Not Found

Detail – No Order found with MerchantID

500

A server error occurred, and the request failed

Message – Internal processing exception

 

Query Payment - Sample Source Code

 

An example of executable JavaScript sample source code to query a payment can be found by clicking on the icon below. Note that this is an example of how a query payment request can be initiated, it is a not a recommendation for how to implement the query API in your own applications.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2024 My Gateway