composer require loganhenson/firstdata
Requires .env file (see .env.example)
<?php
$Transaction = new Transaction(getenv('fd_gateway_id'), getenv('fd_gateway_password'), getenv('fd_key_id'), getenv('fd_key'));
try{
$response = $Transaction->Purchase('Mastercard', 'Logan Henson', 5500000000000004, 1216, 123, 120);
}catch(FirstDataException $e){
echo $e->getMessage();
}
<?php
$Transaction = new Transaction(getenv('fd_gateway_id'), getenv('fd_gateway_password'), getenv('fd_key_id'), getenv('fd_key'));
try{
$response = $Transaction->PreAuth('Mastercard', 'Logan Henson', 5500000000000004, 123, 1216);
// store the $response['transarmor_token']
}catch(FirstDataException $e){
echo $e->getMessage();
}
<?php
// get the transarmor_token from data storage
$Transaction = new Transaction(getenv('fd_gateway_id'), getenv('fd_gateway_password'), getenv('fd_key_id'), getenv('fd_key'));
try{
$latePurchaseResponse = $Transaction->LatePurchase('Mastercard', 'Logan Henson', $response['transarmor_token'], 1216, 123, 120);
}catch(FirstDataException $e){
echo $e->getMessage();
}
## Refund
```php
<?php
$Transaction = new Transaction(getenv('fd_gateway_id'), getenv('fd_gateway_password'), getenv('fd_key_id'), getenv('fd_key'));
try{
$response = $Transaction->Refund('Mastercard', 'Logan Henson', $transarmor_token, 1216, 123, 120);
}catch(FirstDataException $e){
echo $e->getMessage();
}
Can be used before Purchase and LatePurchase
'EUR', 'GBP', 'CHF', 'CZK', 'DKK', 'JPY', 'ZAR', 'SEK', 'CAD'
<?php
$Transaction = new Transaction(getenv('fd_gateway_id'), getenv('fd_gateway_password'), getenv('fd_key_id'), getenv('fd_key'));
try{
$Transaction->setCurrency('CAD');
$response = $Transaction->Purchase('Mastercard', 'Logan Henson', 5500000000000004, 1216, 123, 120);
}catch(FirstDataException $e){
echo $e->getMessage();
}
$Search = new Search(getenv('fd_username'), getenv('fd_password'));
try{
$transactions = $Search->getTransactions();
}catch(FirstDataException $e){
echo $e->getMessage();
}
Visa 4111111111111111 Expiry Date: Any future date.
Mastercard 5500000000000004 Expiry Date: Any future date.
American Express 340000000000009 Note: Amex is 15 characters Expiry Date: Any future date.
JCB 3566002020140006 Expiry Date: Any future date.
Discover 6011000000000004 Expiry Date: Any future date.
Diners Club 36438999960016 Expiry Date: Any future date.om