PHP code example of popphp / pop-payment
1. Go to this page and download the library: Download popphp/pop-payment 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/ */
popphp / pop-payment example snippets
use Pop\Payment\Payment;
use Pop\Payment\Adapter\Authorize;
$payment = new Payment(new Authorize('API_LOGIN_ID', 'TRANSACTION_KEY'));
$payment->amount = 41.51;
$payment->cardNum = '4111111111111111';
$payment->expDate = '03/17';
$payment->firstName = 'Test';
$payment->lastName = 'Person';
$payment->company = 'Test Company';
$payment->address = '123 Main St.';
$payment->city = 'New Orleans';
$payment->state = 'LA';
$payment->zip = '70124';
$payment->country = 'US';
$payment->shippingSameAsBilling();
$payment->send();
if ($payment->isApproved()) {
// If approved
} else if ($payment->isDeclined()) {
// If declined
} else if ($payment->isError()) {
// Some other unknown error
echo $payment->getMessage();
}