HTTP Method | API URL | API Version |
---|---|---|
GET | https://paiement.payzone.ma/transactions/export | >= 002.60 |
This call permits a merchant to obtain information about all transactions in a certain date range.
The parameters can be used to further filter the transactions included in the response.
Name | Type | Value | Required | API Version |
---|---|---|---|---|
apiVersion | String(8) | API version to be used (default 002.61) | no | >= 002.61 |
startTime | String(8) | Minimum processing time of transactions included in the export; inclusive, unix timestamp | yes | >= 002.61 |
endTime | String(8) | Maximum processing time of transactions included in the export; exclusive, unix timestamp | yes | >= 002.61 |
operation | String(32) | Operation of transactions included in the export. Can be sale, authorize, submission, collection, refund_request, refund, rebill and cancel. | no | >= 002.61 |
paymentMethod | String(32) | Payment method of transactions included in the export | no | >= 002.61 |
paymentNetwork | String(32) | Payment network Payment network of transactions included in the export, if provided the paymentMethod - if it is set as well - must be supported by this payment network | no | >= 002.61 |
transactionResultCode | Integer | Result code of transactions included in the export, 0 to 999 | no | >= 002.61 |
The body of the response to a transaction export request is a JSON object and includes the following properties:
Name | Type | Description |
---|---|---|
apiVersion | String(8) | Used API version |
transactions | Array | List of exported transactions, Elements are Transaction objects |
use PayXpert\Connect2Pay\Connect2PayClient;
$url = "https://paiement.payzone.ma";
// This will be provided once your account is approved
$originator = "000000";
$password = "Gr3atPassw0rd!";
$c2pClient = new Connect2PayClient($url, $originator, $password);
$request = new ExportTransactionsRequest();
// fetch for October 2019 (in current timezone)
$request->setStartTime(mktime(0, 0, 0, 10, 1, 2019));
$request->setEndTime(mktime(0, 0, 0, 11, 1, 2019));
// Set additional filtering if required:
// $request->setOperation(...)
// $request->setPaymentMethod(...)
// $request->setTransactionResultCode(...)
// $request->setPaymentNetwork(...)
$response = $c2pClient->exportTransactions($request);
if ($response != null) {
foreach ($response->getTransactions() as $transaction) {
echo "Transaction ID: " . $transaction->getTransactionID();
echo "Amount: " . $transaction->getAmount();
// ...
}
} else {
echo "Error: " . $c2pClient->getClientErrorMessage() . "\n";
}
// The second argument is the originator ID, third one is the associated API key.
// This will be provided once your account is approved.
Connect2payClient c2p = new Connect2payClient("https://paiement.payzone.ma", "123456",
"GreatP4ssw0rd");
TransactionsExportRequest request = new TransactionsExportRequest();
TransactionExportResponse response = null;
Date now = new Date();
Date oneDayBeforeNow = new Date(now - millsecondsInADay);
request.setStartTime(oneDayBeforeNow);
request.setEndTime(now);
// Set additional filtering if required:
// request.setOperation(...)
// request.setPaymentMethod(...)
// request.setTransactionResultCode(...)
// request.setPaymentNetwork(...)
try {
response = c2p.exportTransactions(request);
for (TransactionAttempt transaction : response.getTransactions()) {
System.out.println(transaction.getPaymentMethod());
System.out.println(transaction.getAmount());
System.out.println(response.getResultCode());
// ...
}
} catch (Exception e) {
logger.error("Ooops, an error occurred getting transaction information: " + e.getMessage());
// Handle the error...
}
const gateway = require("payxpert")("123456", "GreatP4ssw0rd").connect2pay;
let currentTimestamp = Math.floor(Date.now() / 1000);
let requestBody = {
startTime: currentTimestamp - (3600 * 5),
endTime: currentTimestamp + (3600 * 5)
};
let exportResponse = await connect2pay.exportTransactionsList(requestBody);
let exportedTransactionsArray = exportResponse.transactions;
// ...