A
A
AntonIgin2017-06-03 18:01:20
Django
AntonIgin, 2017-06-03 18:01:20

How to protect the amount of payment in the form from editing?

I'll start by describing the implementation of the payment system.
For payment, the Yandex.Money service is used, a form has been created with the attributes necessary to request and go to a protected area. But here's the problem: in the page code, the user can change any payment data, including the amount and addressee. Yes, you can, of course, double-check each order manually, but that's not it.
Actually, the code of the form:

<form action="https://money.yandex.ru/quickpay/confirm.xml" id ='formx' method="post" onsubmit='call()'>
    {{ form.as_p}}
    {% csrf_token %}
    <input type="hidden" id='receiver' name="receiver" value="41001681163599"> 
    <input type="hidden" id='quickpay-form' name="quickpay-form" value="small"> 
    <input type="hidden" id='targets' name="targets" value="транзакция J-star"> 
    <input type="hidden" id='sum' name="sum" value="{{cart.get_total_price}}"> 
    <input type="hidden" id='paymentType' name="paymentType" value="AC">
    <input type='submit' value='Отправить' onClick='create_Order()'/>
    </form>

The only option that I see:
1. Save the so-called. anonymous order. The shopping cart has a "Checkout" button, which leads to a form with data sent immediately to Yandex. To the view connected to this button, you can attach the creation of an order object with a number, content, and amount, but without customer data.
" 3.
Send the form data not to Yandex, but to my view, which, in turn, will add an anonymous order created earlier and make a request to Yandex, redirecting the user.
Actually, the question is: how to do this? task without binding to Yandex,
PS In short, I need to simulate a form POST request in a view with all the features, in particular with a redirect.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2017-06-03
@AntonIgin

In general, this is the wrong approach. Who will protect you from data spoofing in a POST request?
You need to control the amount paid for the goods after payment by verifying the digital signature that was returned to you from the merchant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question