Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Library of payment gateways
branch: master

This branch is even with raymondjavaxx:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
library/PHPMerchant
test
README.mdown

README.mdown

Usage:

<?php

require_once 'PHPMerchant/PHPMerchant.php';
require_once 'PHPMerchant/Billing/Gateway/PayPal.php';

$card = new PHPMerchant_Billing_CreditCard(array(
        'first_name' => 'John',
        'last_name'  => 'Doe',
        'number'     => '4111111111111111',
        'month'      => 12,
        'year'       => 2018,
        'verification_value' => 123,
        'type'       => 'visa'
));

if ($card->isValid()) {
        $gateway = new PHPMerchant_Billing_Gateway_PayPal(array(
                'login'     => 'testlogin',
                'password'  => 'testpassword',
                'signature' => 'testsignature',
                'test'      => true
        ));

        $response = $gateway->purchase(1000, $card);
        if ($response->success) {
                echo "Purchase complete!";
        } else {
                echo "Error: " . $response->message;
        }

} else {
        echo "Error: credit card is not valid. " . join('. ', $card->errors());
}
Something went wrong with that request. Please try again.