johndoejdg / robokassa
PHP library for Robokassa payment system
v1.0.0-beta3
2015-04-10 13:13 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2025-01-08 11:17:00 UTC
README
Installation
Install this package through Composer. To your composer.json
file, add:
{ "require": { "johndoejdg/robokassa": "dev-master" } }
Examples
Create payment:
$payment = new \Idma\Robokassa\Payment( 'john_doe', 'password1', 'password2', true ); $payment ->setInvoiceId($order->id) ->setSum($order->amount) ->setDescription('Payment for some goods'); // redirect to payment url $user->redirect($payment->getPaymentUrl());
Check payment result:
// somewere in result url handler... ... $payment = new \Idma\Robokassa\Payment( 'john_doe', 'password1', 'password2', true ); if ($payment->validateResult($_GET) { $order = Orders::find($payment->getInvoiceId()); if ($payment->getSum() == $order->sum) { } // send answer echo $payment->getSuccessAnswer(); // "OK1254487\n" } ...
Check payment on Success page:
... $payment = new \Idma\Robokassa\Payment( 'john_doe', 'password1', 'password2', true ); if ($payment->validateSuccess($_GET) { $order = Orders::find($payment->getInvoiceId()); if ($payment->getSum() == $order->sum) { // payment is valid } } ...