Here, viewRequestState(String serverCorrelationId) creates a GET request to /requeststates/{serverCorrelationId}
This endpoint returns a specific request state.
MMClient mmClient = new MMClient("<Place your consumer key>", "<Place your consumer secret>", "<Place your API key>");
Transaction transaction = new Transaction();
DisbursementRequest disbursementRequest = new DisbursementRequest();
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>");
disbursementRequest.setTransaction(transaction);
AsyncResponse sdkResponse = mmClient.addRequest(disbursementRequest).setNotificationType(NotificationType.POLLING).createDisbursementTransaction();
sdkResponse = mmClient.addRequest(disbursementRequest).viewRequestState(sdkResponse.getServerCorrelationId());{
"serverCorrelationId": "74fda17c-d7b9-4d6e-908a-62eb8eeef7d9",
"status": "completed",
"notificationMethod": "polling",
"objectReference": "REF-1639459534512",
"pollLimit": 100
}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.