- Check Bearer
- Users
- Charges
- Amounts
- Refunds
$ composer require chiarillomassimo/satispay-php-sdk
use ChiarilloMassimo\Satispay\Authorization\Bearer;
use ChiarilloMassimo\Satispay\Satispay;
$satispay = new Satispay(
new Bearer('osh_...'),
'sandbox'
);
if ($satispay->getBearerHandler()->isAuthorized()) {
....
};
$satispay->getUserHandler()->createByPhoneNumber('+39 yourphone')
$user = new User(null, '+39 yourphone');
$satispay->getUserHandler()->persist($user)
$satispay->getUserHandler()->findOneById('id')
$satispay->getUserHandler()->find()
$satispay->getUserHandler()->find(50, 'starting_id', 'ending_id')
$users = $satispay->getUserHandler()->find();
foreach ($users as $user) {
//...
}
use ChiarilloMassimo\Satispay\Model\Charge;
$charge = new Charge();
$user = $satispay->getUserHandler()->createByPhoneNumber('+39 yourphone');
$charge
->setUser($user)
->setAmount(15) // 0.15 €
->setCallbackUrl('http://fakeurl.com/satispay-callback')
->setCurrency('EUR')
->setDescription('Test description')
->setExpireMinutes(20)
->setExtraFields([
'orderId' => 'id',
'extra' => 'extra'
])
->setSendMail(false);
$satispay->getChargeHandler()->persist($charge, true);
$charge->isPaid(); //false
$charge->getStatus(); //Charge::STATUS_REQUIRED
$satispay->getChargeHandler()->findOneById('charge_id')
$charge = $satispay->getChargeHandler()->findOneById('charge_id')
$charge->setDescription('My fantastic description!!')
$satispay->getChargeHandler()->update($charge)
$satispay->getChargeHandler()->find()
$satispay->getChargeHandler()->find(50, 'starting_id', 'ending_id')
$charges = $satispay->getChargeHandler()->find();
foreach ($charges as $charge) {
//...
}
use \ChiarilloMassimo\Satispay\Model\Refund;
$charge = $satispay->getChargeHandler()->findOneById('id');
$refund = new Refund();
$refund
->setCharge($charge)
->setDescription('Test')
->setAmount(15)
->setReason(Refund::DUPLICATE);
$satispay->getRefundHandler()->persist($refund);
$satispay->getRefundHandler()->findOneById('id'));
$refund = $satispay->getRefundHandler()->findOneById('id');
$refund->setDescription('My fantastic description!!');
$satispay->getRefundHandler()->update($refund);
$satispay->getRefundHandler()->find()
$satispay->getRefundHandler()->find(50, 'starting_id', 'ending_id')
$refunds = $satispay->getRefundHandler()->find();
foreach ($refunds as $refund) {
//...
}
$amount = $satispay->getAmountHandler()->findBy(
new DateTime('2018-01-01'),
new DateTime('now')
);