transactionspayment-gatewayglobal-payments-api

How to query past payments in Global Payments API


This should be a common scenario but I could not find any API calls to do this on Global Payments.

Suppose we try to pay something and we then generate and HPP json by doing:

hppJson = service.charge(new BigDecimal(paymentDTO.getAmount()))
                .withCurrency(paymentDTO.getCurrency())
                .withHostedPaymentData(hostedPaymentData)
                .withAddress(billingAddress, AddressType.Billing)
                .withAddress(shippingAddress, AddressType.Shipping)
                .serialize();

Then after customer gets redirected to the payment page of Global payments, he add card details and pay. If the payment was successful from global payments, it will redirect the user to our specified url. My question is if our services are unavailable when redirecting, is there a way to query that past successful transaction by using anything in that HPP Json? like order ID etc?


Solution

  • This can be accomplished with the following code:

    TransactionSummary response = ReportingService.transactionDetail("{YOUR ORDER ID HERE}").execute();
    

    Additional supporting code can be found in the following files within GitHub for the Java SDK.

    https://github.com/globalpayments/java-sdk/blob/master/src/test/java/com/global/api/tests/realex/RealexReportingTests.java