PHP SDK for AlternativePayments API
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Lib/AlternativePayments update payment methods Sep 27, 2017
samples Added transaction samples May 11, 2018
tests Removing redundand properties Jul 4, 2016
.gitignore ap-php-sdk new payment methods added Jul 4, 2017
LICENSE Initial commit Jul 2, 2015
README.md Create README file Aug 17, 2016
composer.json added composer Sep 27, 2017

README.md

PHP SDK for Alternative Payments RESTful API

Installation

Requirements

PHP 5.3.3 and later. cURL extension.

Developer Documentation

Official Alternative Payments RESTful API Reference

Composer

It's recommended to use composer or you can download the latest release.

composer require alternativepayments/alternativepayments

Usage

To load the Alternative Payments PHP SDK you have to include autoloader:

require_once '/path/to/your-project/vendor/autoload.php';

To use Alternative Payments PHP SDK you need to setup your secret integration key:

use AlternativePayments\Config;
Config :: setApiKey("sk_test_rHErfsdjgfk9.....lFbfdsgh3mv0M");

SEPA transaction request example:

require_once '../vendor/autoload.php';

use AlternativePayments\Config;
Config :: setApiKey("sk_test_rHErfsdjgfk9.....lFbfdsgh3mv0M");

$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john.doe@example.com");
$customer->setCountry("BE");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \AlternativePayments\Model\Payment();
$payment->setPaymentOption("SEPA");
$payment->setHolder("John Doe");
$payment->setIBAN("BE88271080782541");
$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setAmount(4500);
$transaction->setCurrency("EUR");
$transaction->setDescription("test sepa php sdk");
$transaction->setMerchantPassThruData("test_sepa_123");
$transaction->setIPAddress("127.0.0.1");
$res = \AlternativePayments\Transaction :: post($transaction);

For more examples check samples folder.

License

Read License for more licensing information.