M
M
maximus2016-07-12 06:29:31
PHP
maximus, 2016-07-12 06:29:31

How to make the robokassa class accept dollars instead of rubles?

Good afternoon!
There is a billing class of robokassa:

<?php   if(!defined('BASEPATH')) exit('No direct script access allowed');

class Robokassa_lib
{
    public $login;
    private $password1;
    private $password2;
    public $api_pay_url;
    
    function __construct($settings)
    {
        $settings = $settings['settings'];
        $this->login 	  = $settings->robokassa_login;
    $this->password1  = $settings->robokassa_passwd1;
    $this->password2  = $settings->robokassa_passwd2;
        
        $this->api_pay_url   = $settings->robokassa_pay_url;
    }
    
    function getUrl($summ, $idOrder, $idItem, $itemDesc, $encoding = 'utf-8', $language = 'ru')
    {
        return $this->api_pay_url.
            'MrchLogin='.$this->login.
            '&OutSum='.$summ.
            '&InvId='.$idOrder.
            '&Desc='.$itemDesc.
            '&Shp_item='.$idItem.
            '&SignatureValue='.$this->createCrc($summ, $idOrder, $idItem).
            '&Culture='.$language.
            '&Encoding='.$encoding;
    }
    
    function createCrc($summ, $idOrder, $OutSumCurrency = 'USD', $idItem)
    {
        $crc = "{$this->login}:{$summ}:{$idOrder}:{$this->password1}:Shp_item={$idItem}";
        return md5($crc);
    }
    
    private function _check_crc($password)
    {
        $summa = $this->getSumma();
        $idOrder = $this->getIdOrder();
        $idItem = $this->getIdItem();
        $crc = strtoupper($this->getCrc());
        $my_crc = strtoupper(md5("{$summa}:{$idOrder}:{$password}:Shp_item={$idItem}"));
        return ($my_crc == $crc) ? true : false;
    }
    
    // get status
    function is_payed()
    {
        return $this->_check_crc($this->password1);
    }
    function is_ordered()
    {
        return $this->_check_crc($this->password2);
    }
    
    // get params
    function getSumma()
    {
        return @$_GET["OutSum"];
    }
    function getIdOrder()
    {
        return @$_GET["InvId"];
    }
    function getIdItem()
    {
        return @$_GET["Shp_item"];
    }
    function getCrc()
    {
        return @$_GET["SignatureValue"];
    }  
}

?>

how to add the OutSumCurrency parameter to it so that you can accept payments in dollars?
Doku: docs.robokassa.ru/#1205
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question