Here, viewTransaction(String transactionReference) creates a GET request to /transactions/{transactionReference}
This endpoint returns the details of a transaction.
MMClient mmClient = new MMClient("<Place your consumer key>", "<Place your consumer secret>", "<Place your API key>");
BillPaymentRequest billPaymentRequest = new BillPaymentRequest();
Transaction transaction = new Transaction();
List<AccountIdentifier> debitPartyList = new ArrayList<>();
List<AccountIdentifier> creditPartyList = new ArrayList<>();
debitPartyList.add(new AccountIdentifier("<identifier type>", "<identifier>"));
creditPartyList.add(new AccountIdentifier("<identifier type>", "<identifier>"));
transaction.setDebitParty(debitPartyList);
transaction.setCreditParty(creditPartyList);
transaction.setAmount("<amount>");
transaction.setCurrency("<currency>");
billPaymentRequest.setTransaction(transaction);
AsyncResponse sdkResponse = mmClient.addRequest(billPaymentRequest).addCallBack("<Place your callback URL>").createBillTransaction();
sdkResponse = mmClient.addRequest(billPaymentRequest).viewRequestState(sdkResponse.getServerCorrelationId());
String txnRef = sdkResponse.getObjectReference();
Transaction transactionResponse = mmClient.addRequest(billPaymentRequest).viewTransaction(txnRef);{
"transactionReference": "REF-16396528465317",
"creditParty": [
{
"key": "accountid",
"value": "2999"
},
{
"key": "mandatereference",
"value": "REF-1637907197912"
},
{
"key": "mandatereference",
"value": "REF-1637907232832"
},
{
"key": "mandatereference",
"value": "REF-1637907265888"
},
{
"key": "mandatereference",
"value": "REF-1637907412029"
},
{
"key": "mandatereference",
"value": "REF-1637907483978"
},
{
"key": "mandatereference",
"value": "REF-1637909732171"
},
{
"key": "mandatereference",
"value": "REF-1638330257762"
},
{
"key": "mandatereference",
"value": "REF-1638360515423"
},
{
"key": "mandatereference",
"value": "REF-1638444910612"
},
{
"key": "mandatereference",
"value": "REF-1639023787539"
}
],
"debitParty": [
{
"key": "accountid",
"value": "2999"
},
{
"key": "mandatereference",
"value": "REF-1637907197912"
},
{
"key": "mandatereference",
"value": "REF-1637907232832"
},
{
"key": "mandatereference",
"value": "REF-1637907265888"
},
{
"key": "mandatereference",
"value": "REF-1637907412029"
},
{
"key": "mandatereference",
"value": "REF-1637907483978"
},
{
"key": "mandatereference",
"value": "REF-1637909732171"
},
{
"key": "mandatereference",
"value": "REF-1638330257762"
},
{
"key": "mandatereference",
"value": "REF-1638360515423"
},
{
"key": "mandatereference",
"value": "REF-1638444910612"
},
{
"key": "mandatereference",
"value": "REF-1639023787539"
}
],
"type": "merchantpay",
"transactionStatus": "pending",
"amount": "200.00",
"currency": "RWF",
"creationDate": "2021-12-10T09:27:45",
"modificationDate": "2021-12-10T09:27:45",
"requestDate": "2021-12-10T09:27:45"
}In asynchronous flows, a callback mechanism or polling mechanism is utilised to allow the client to determine the request's final state. Use the viewRequestState() function for the polling mechanism to receive the status of a request, and the viewTransaction() function to acquire the final representation of the Transaction object.