Run the following command:
composer require satispay/online-api-php-sdk
If you do not wish to use Composer, require the init.php
file.
require_once('/path/init.php');
// Set security bearer
\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');
// Set sandbox, true or false (not mandatory), default false
\SatispayOnline\Api::setSandbox(true);
https://s3-eu-west-1.amazonaws.com/docs.online.satispay.com/index.html
\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');
try {
\SatispayOnline\Bearer::check();
echo 'OK';
} catch(\Exception $ex) {
echo 'Invalid Security Bearer';
}
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');
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'
]);
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');