1. Go to this page and download the library: Download dmitrytrish/robokassa library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dmitrytrish / robokassa example snippets
$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());
// 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"
}
...
...
$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
}
}
...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.