This function allows merchant to blacklist a customer information from a previous transaction identified by transactionID
. The following customer information will be added to the blacklist database: cardNumber
, cardHolderEmail
and/or customerIP
.
HTTP Method | API URL | API Version |
---|---|---|
POST | https://api.payzone.ma/transactions/{transactionID}/blacklist | >= 002 |
URL Field | Type | Max Length | Required | Description |
---|---|---|---|---|
transactionID | String | 40 | yes | Reference of the transaction whose elements need to be added to blacklist. |
Get Fields | Type | Max Length | Required | Description |
---|---|---|---|---|
cardNumberBlackList | String | 20 | no | Whether or not the cardNumber will be added to the blacklist (0 or 1 - default 0). |
shopperEmailBlackList | String | 20 | no | Whether or not the shopperEmail will be added to the blacklist (0 or 1 - default 0). |
customerIPBlackList | String | 20 | no | Whether or not the customerIP will be added to the blacklist (0 or 1 - default 0). |
Note: Gateway API transactions are done with a different library than payment-page API. See the code sample comments for more info:
/*
* Transaction name is 'BlacklistTransaction', once you create a new transaction passing this as parameter,
* you need to set the mandatory data using the following method:
* setTransactionID()
* setBlacklistTransactionFlags()
*/
$client = new GatewayClient();
$transaction = $client->newTransaction('BlacklistTransaction', 'testMerchant', 'testPassword');
$transaction->setTransactionID($transactionID);
$transaction->setBlacklistTransactionFlags(true, true, false); //blacklists the card number, the email, but not the IP address of the referral transaction
$response = $transaction->send();
if ('000' === $response->errorCode) {
//nothing
} else {
echo "Error {$response->errorCode} with message {$response->errorMessage}";
}
PaymentGatewayConnector connector = new PaymentGatewayConnector(API_URL, ORIGINATOR, PASSWORD);
BlacklistTransactionResponse response = null;
BlacklistTransactionRequest request = new BlacklistTransactionRequest();
request.setTransactionId(myTransaction.getTransactionId());
request.blacklistCardNumber().blacklistShopperEmail().blacklistCustomerIP(); // Adjust accordingly
try {
response = connector.doBlacklistTransaction(request);
} catch (Exception e) {
e.printStackTrace();
}
if (response != null) {
if (TransactionResultCode.TRANSACTION_SUCCESSFULLY.equals(response.getErrorCode()) {
System.out.println("Success: " + response.getErrorMessage());
} else {
System.out.println("Failure: " + response.getErrorMessage());
}
}
const gateway = require("payxpert")("123456", "GreatP4ssw0rd").gateway;
let transactionID = "111...";
let requestBody = {
'cardNumberBlackList':'0',
'shopperEmailBlackList':'1',
'customerIPBlackList':'0'
};
let responseBlacklist = await gateway.blacklistUsers(transactionID, requestBody);
if (responseBlacklist.code == "000") {
// Success
}
var client = new GatewayClient(OriginatorConfig.ORIGINATOR_ID, OriginatorConfig.ORIGINATOR_PASSWORD);
var blacklistTransaction = client.NewBlacklistUserTransaction(transactionID);
blacklistTransaction.DoBlacklistCardNumber();
var blacklistResponse = await blacklistTransaction.Send();
if (blacklistResponse.IsSuccessfull())
{
Console.WriteLine("Blacklist is ok: " + blacklistResponse.errorMessage);
}
else
{
Console.WriteLine("Error blacklisting: " + blacklistResponse.errorMessage);
}
The body of the response is in JSON format.
The following fields are present in the response :
Name | Type | Description |
---|---|---|
errorCode | String | See API Response Codes |
errorMessage | String | See API Response Codes |