V
V
Viva88882021-07-01 15:27:15
CodeIgniter
Viva8888, 2021-07-01 15:27:15

How to set up yoomoney for a website?

Hello. Transaction data is not added to the database after a test translation into Yumani.

my view

<form method="POST" action="https://yoomoney.ru/quickpay/confirm.xml">    
  <input type="hidden" name="receiver" value="410011xxxx14839">   
  <input type="hidden" name="quickpay-form" value="shop">
  <input type="hidden" name="label" value="<?= $this->session->userdata('id') ?>">
  <input type="hidden" name="targets" value="Тест">  
  <input type="hidden" name="paymentType" value="PC">
  <input  name="sum" value="4568.25" data-type="number" placeholder="Сумма"> 
    
    <input type="submit" value="Перевести">
</form>


My controller

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

class Yoomoney extends MY_Controller {

  public function __construct()
  {
    parent::__construct();
  }

  public function index()
  {
    
    $this->load->model('yoomoney_model');
    if(isset($_POST['notification_type'])){
      $hash = sha1($_POST['notification_type'].'&'.
       		$_POST['operation_id'].'&'.
       		$_POST['amount'].'&'.
       		$_POST['currency'].'&'.
       		$_POST['datetime'].'&'.
       		$_POST['sender'].'&'.
       		$_POST['codepro'].'&'.
       		'1vCpCaBwxxxxOEVPmv0l8Vy '.'&'.
       		$_POST[' label']); 
      if($_POST['sha1_hash'] != $hash || $_POST['codepro'] === true ||  $_POST['unaccepted'] === true) die();
      else{
        // file_get_contents('history.php', 1, FILE_APPEND);
        $add['amount'] = $_POST['amount'];
        $add['user_id'] = $_POST[' label'];
        $add['ps_id'] = 1;
        $this->yoomoney_model->add_transaction($add);
        echo "Успешно";
        die();
      }
    }
    $this->load->view('templates/yoomoney_view');	
  }
}


Model

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

class Yoomoney_model extends CI_Model {

  public function add_transaction($add)
  {
    $this->db->insert('transactions', $add);
  }
}

Set up a notification
60ddb6297298f224875862.png

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