1. Go to this page and download the library: Download maxmind/minfraud library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maxmind / minfraud example snippets
$mf = new MinFraud(1, 'ABCD567890', [ 'host' => 'sandbox.maxmind.com' ]);
axMind\MinFraud;
# The constructor for MinFraud takes your account ID, your license key, and
# optionally an array of options.
$mf = new MinFraud(1, 'ABCD567890');
# Note that each ->with*() call returns a new immutable object. This means
# that if you separate the calls into separate statements without chaining,
# you should assign the return value to a variable each time.
$request = $mf->withDevice(
ipAddress: '152.216.7.110',
sessionAge: 3600.5,
sessionId: 'foobar',
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36',
acceptLanguage: 'en-US,en;q=0.8'
)->withEvent(
transactionId: 'txn3134133',
shopId: 's2123',
time: '2012-04-12T23:20:50+00:00',
type: 'purchase'
)->withAccount(
userId: 3132,
usernameMd5: '4f9726678c438914fa04bdb8c1a24088'
)->withEmail(
address: '[email protected]',
domain: 'maxmind.com'
)->withBilling(
firstName: 'First',
lastName: 'Last',
company: 'Company',
address: '101 Address Rd.',
address2: 'Unit 5',
city: 'New Haven',
region: 'CT',
country: 'US',
postal: '06510',
phoneNumber: '123-456-7890',
phoneCountryCode: '1'
)->withShipping(
firstName: 'ShipFirst',
lastName: 'ShipLast',
company: 'ShipCo',
address: '322 Ship Addr. Ln.',
address2: 'St. 43',
city: 'Nowhere',
region: 'OK',
country: 'US',
postal: '73003',
phoneNumber: '123-456-0000',
phoneCountryCode: '1',
deliverySpeed: 'same_day'
)->withPayment(
processor: 'stripe',
wasAuthorized: false,
declineCode: 'invalid number'
)->withCreditCard(
issuerIdNumber: '411111',
lastDigits: '7643',
bankName: 'Bank of No Hope',
bankPhoneCountryCode: '1',
bankPhoneNumber: '123-456-1234',
avsResult: 'Y',
cvvResult: 'N',
was3dSecureSuccessful: true
)->withOrder(
amount: 323.21,
currency: 'USD',
discountCode: 'FIRST',
isGift: true,
hasGiftMessage: false,
affiliateId: 'af12',
subaffiliateId: 'saf42',
referrerUri: 'http://www.amazon.com/'
)->withShoppingCartItem(
category: 'pets',
itemId: 'leash-0231',
quantity: 2,
price: 20.43
)->withShoppingCartItem(
category: 'beauty',
itemId: 'msc-1232',
quantity: 1,
price: 100.00
)->withCustomInputs([
'section' => 'news',
'previous_purchases' => 19,
'discount' => 3.2,
'previous_user' => true,
]);
# To get the minFraud Factors response model, use ->factors():
$factorsResponse = $request->factors();
print($factorsResponse->subscores->emailAddress . "\n");
# To get the minFraud Insights response model, use ->insights():
$insightsResponse = $request->insights();
print($insightsResponse->riskScore . "\n");
print($insightsResponse->creditCard->issuer->name . "\n");
foreach ($insightsResponse->warnings as $warning) {
print($warning->warning . "\n");
}
# To get the minFraud Score response model, use ->score():
$scoreResponse = $request->score();
print($scoreResponse->riskScore . "\n");
foreach ($scoreResponse->warnings as $warning) {
print($warning->warning . "\n");
}
axMind\MinFraud\ReportTransaction;
# The constructor for ReportTransaction takes your account ID, your license key,
# and optionally an array of options.
$rt = new ReportTransaction(1, 'ABCD567890');
$rt->report(
ipAddress: '152.216.7.110',
tag: 'chargeback',
chargebackCode: 'UA02',
minfraudId: '26ae87e4-5112-4f76-b0f7-4132d45d72b2',
maxmindId: 'aBcDeFgH',
notes: 'Found due to non-existent shipping address',
transactionId: 'cart123456789'
);