Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Latest commit

 

History

History
137 lines (98 loc) · 2.67 KB

README.md

File metadata and controls

137 lines (98 loc) · 2.67 KB

Satispay Online API PHP SDK

Packagist Version Packagist Downloads

Composer Installation

Run the following command:

composer require satispay/online-api-php-sdk

Manual Installation

If you do not wish to use Composer, require the init.php file.

require_once('/path/init.php');

Getting Started

// Set security bearer
\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

// Set sandbox, true or false (not mandatory), default false
\SatispayOnline\Api::setSandbox(true);

Documentation

https://s3-eu-west-1.amazonaws.com/docs.online.satispay.com/index.html

Examples

Check bearer

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

try {
  \SatispayOnline\Bearer::check();
  echo 'OK';
} catch(\Exception $ex) {
  echo 'Invalid Security Bearer';
}

Users

Create user

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$user = \SatispayOnline\User::create([
  'phone_number' => '+390000000000'
]);

Get users

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$users = \SatispayOnline\User::all();

Get user

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$user = \SatispayOnline\User::get('userid');

Charges

Create charge

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$charge = \SatispayOnline\Charge::create([
  'user_id' => 'userid',
  'currency' => 'EUR',
  'amount' => 1000
]);

Get charges

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$charges = \SatispayOnline\Charge::all();

Get charge

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$charge = \SatispayOnline\Charge::get('chargeid');

Update charge

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$charge = \SatispayOnline\Charge::update('chargeid', [
  'description' => 'newdescription'
]);

Refunds

Create refund

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$refund = \SatispayOnline\Refund::create([
  'charge_id' => 'chargeid',
  'currency' => 'EUR',
  'amount' => 1000
]);

Get refunds

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$refunds = \SatispayOnline\Refund::all();

Get refund

\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

$refund = \SatispayOnline\Refund::get('refundid');