Basic Usage

include('/path/to/lib/payments.php');

$payments = new PHP_Payments;

$config = Payment_Utility::load('config', '/path/to/config/file'); //You can do this or you can make this an array.  Config file is recommended since configuration needs differ by gateway.

//Make the call
$response = $payments->payment_action('gateway_name', $params, $config);

Responses

There are two types of responses returned, local responses and gateway responses. If a method is not supported, required params are missing, a gateway does not exist, etc., a local response will be returned. This prevents the transaction from being sent to the gateway and the gateway telling you 3 seconds later there is something wrong with your request.

Accessing response properties looks like this:

$status = $response->status;

Gateway responses will usually have a full response from the gateway, and on failure a 'reason' property in the details object:

$gatway_response = $response->details;

$failure_reason = $response->reason;

Support PHP-Payments

This stuff takes a lot of hard work. To date, we've logged hundreds of hours on this project, and sadly free code doesn't pay bills.

Contribute Code