PHP code example of vhar / robokassa
1. Go to this page and download the library: Download vhar/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/ */
vhar / robokassa example snippets
$merchant = [
'login' => 'merchant_login',
'password1' => 'password1',
'password2' => 'password2',
'hashType' => 'md5',
];
$invoiceItems = [
[
'Cost' => 1,
'Name' => 'Сервис 1',
'Quantity' => 1,
'PaymentMethod' => 'full_payment',
'PaymentObject' => 'service',
'Tax' => 'none',
'NomenclatureCode' => 'IYVITCUR%XE^$X%C^T&VITC^RX&%ERC^TIRX%&ERCUITRXE&ZX%R^CTIR^XUE%ZN1m9E+1¦?5O?6¦?168'
],
];
$orderData = [
'MerchantLogin' => 'merchant_login',
'InvoiceType' => 'OneTime',
'OutSum' => 1,
'Description' => 'Счет № 1',
'ExpirationDate' => Carbon::now()->timezone('Europe/Moscow')->addMinutes(5)->format("Y-m-d\\TH:i:s.u"),
'MerchantComments' => 'Оплатить до ' . Carbon::now()->timezone('Europe/Moscow')->addMinutes(5)->format("Y-m-d H:i:s"),
'Culture' => 'ru',
'InvoiceItems' => $invoiceItems
];
$merchant = Merchant::from($merchant);
$robokassa = new Robokassa($merchant);
$invoice = InvoiceJWT::from($orderData);
$response = $robokassa->createInvoice($invoice);
print_r($response->toArray());
$merchant = [
'login' => 'merchant_login',
'password1' => 'password1',
'password2' => 'password2',
'hashType' => 'md5',
];
$merchant = Merchant::from($merchant);
$robokassa = new Robokassa($merchant);
$status = $robokassa->opStateExt(2024021501);
print_r($status->toArray());