Skip to content
Платежи через Робокассу
Branch: master
Clone or download
#12 Compare This branch is 12 commits ahead of aleksxp:master.
Latest commit 19ce0cd Sep 28, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src issue #9 (#10) Sep 28, 2017
.gitignore Initial commit Nov 9, 2014
LICENSE Initial commit Nov 9, 2014
README.md remove validation on FailURL Apr 10, 2015
composer.json Fix composer.json Nov 9, 2014

README.md

PHP library for Robokassa payment system

Latest Unstable Version Latest Stable Version Total Downloads License

Installation

Install this package through Composer. To your composer.json file, add:

{
    "require": {
        "idma/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
    }

}
...
You can’t perform that action at this time.