STORE PAYMENT INFORMATION

STORE PAYMENT

This code steps you through the process of storing a customer’s payment information securely with pay2amigos. The code returns a Transaction ID, which you can use as a token for future transactions. Depending on the interface you’re using, the Transaction ID is either “Master ID” or “RRNO.”

This process does not validate the credit card nor does it authorize payments.

For that Go to: Run a credit card transaction, Authorize a credit card transaction

The following sample code calls a routine from our Code Library.
Download pay2amigos.php
Or, download via GitHub

<?php
/**
* Pay2amigos PHP Sample Code
*
* This code sample runs a $0.00 Credit Card Auth transaction
* against a customer using test payment information.
* This stores the customer's payment information securely in
* Pay2amigos to be used for further transactions.
*/
include('../Pay2amigos.php');
$accountID = "Merchant's Account ID Here";
$secretKey = "Merchant's Secret Key Here";
$mode = "TEST";
$payment = new Pay2amigos(
   
$accountID,
   
$secretKey,
   
$mode
);
$payment->setCustomerInformation(array(
   
'firstName' => 'Bob',
   
'lastName' => 'Tester',
   
'addr1' => '1234 Test St.',
   
'addr2' => 'Apt #500',
   
'city' => 'Testville',
   
'state' => 'IL',
   
'zip' =>'54321',
   
'country' => 'USA',
   
'phone' => '1231231234',
   
'email' => '[email protected]'
));
$payment->setCCInformation(array(
   
'cardNumber' => '4111111111111111', // Card Number: 4111111111111111
   
'cardExpire' => '1225', // Card Expire: 12/25
   
'cvv2' => '123' // Card CVV2: 123
));
$payment->auth('0.00'); // Card Authorization amount: $0.00
// Makes the API request with Pay2amigos
$payment->process();
if(
$payment->isSuccessfulResponse()){
   
// Reads the response from Pay2amigos
   
echo
   
'Status: '. $payment->getStatus() . "\n" .
   
'Message: '. $payment->getMessage() . "\n" .
   
'Transaction ID: '. $payment->getTransID() . "\n" .
   
'AVS Response: ' . $payment->getAVSResponse() . "\n" .
   
'CVS Response: ' . $payment->getCVV2Response() . "\n" .
   
'Masked Account: ' . $payment->getMaskedAccount() . "\n" .
   
'Card Type: ' . $payment->getCardType() . "\n" .
   
'Authorization Code: ' . $payment->getAuthCode() . "\n";
} else{
    echo
$payment->getMessage() . "\n";
}
?>
Can’t find what you’re
looking for? We can help.

Contact 855-422-9385 for Integration Support.

compress_logo-cred-ms-gold-01a
logo-cred-komen-01a
footer-steve2018-award
cnp-2018-rev
footer-tsg2018-award
compress_pillar_2017