Good day.

My bot in Telegram connects the site where you can replenish the in-game currency in the bot. As a payment aggregator, I use the service https://enpay.ru. The operation algorithm is as follows:

  1. The user drives in how many he wants to buy currency;
  2. The currency is converted into a price;
  3. The price is formed (for 1 coin - 1.4 rubles, for example);
  4. User goes to payment page;

Everything would be fine, the payment goes well, but the handler does not work further - the balance is not charged to the user. Checked whether the requests go there in such a way:

if ($request->isMethod('post')) { User::where('id', 1) ->update([ 'exp' => 999 ]); } 

But exp user remained unchanged.

 public function result(Request $request) { $payment = Payment::findOrFail($request->post('order_id')); $user = User::findOrFail($payment->user_id); $secretkey = 'XXXXXXXXXXXX'; // секретное слово. // $hash = md5($secretkey .':' . $_POST['amount'] . ':' . $_POST['payment_id'] . ':' . $_POST['order_id'] . ':' . $_POST['merchant']); // // if ($hash != $_POST['sign'] ) { // return redirect()->route('home')->with('error', 'Подделка платежа!'); // } $payment->update([ 'status' => 'success', ]); $tons = ($request->post('amount') * 1.4); return User::where('id', $payment->user_id) ->update([ 'tons' => ($user->tons + $tons) ]); } 

Routes look like this:

 Route::get('/payments/pay/{id}', 'PaymentsController@index')->where('id', '[0-9]+')->name('payments'); Route::get('/payments/success', 'PaymentsController@success')->name('payments.success'); Route::get('/payments/fail', 'PaymentsController@fail')->name('payments.fail'); Route::any('/payments/result', 'PaymentsController@result')->name('payments.result'); 

The order_id in the table and the order_id from the POST data match.

What could be the problem? An example of a handler is here, the code was taken from there: https://enpay.ru/api.php

    0