V
V
vikholodov2018-07-17 19:58:43
Python
vikholodov, 2018-07-17 19:58:43

Where is the error in the formation of the Robokassa request?

Good evening everyone!
Something doesn’t boil my head at all today, I get an error when I try to pay for the generated url, swears at “Invalid parameter: Signature”, everything seems to be according to the manual, without additional. parameters Shp_project and Shp_items everything works fine, payments go through. Maybe I don't see a typo at point-blank range, or I form the url incorrectly? So, I need your help guys.

amount = request.POST['amount']
        project_id = request.POST.get('project_id')
        item_bought = request.POST.get('item_bought')
        payment_method = request.POST['method']
        inv_id_obj = TopUpPayment.objects.create(user=request.user, amount=amount).id
        inv_id = 'InvoiceID=%s' % inv_id_obj
        login = 'MerchantLogin=*store_login*'
        sum = 'OutSum=%s' % amount
        method = 'IncCurrLabel=%s' % payment_method
        description = 'Description=Пополнение баланса акканута'
        email = 'email=%s' % request.user.email
        if project_id and len(project_id) > 0 and item_bought and len(item_bought) > 0:
            signature = hashlib.md5( ("*store_name*:%s:%s:*pass*:Shp_project=%s:Shp_items=%s" % (amount, inv_id_obj, project_id, item_bought) ).encode('utf-8') ).hexdigest()
            robokassa_get = 'https://auth.robokassa.ru/Merchant/Index.aspx?{login}&{sum}&{inv_id}&{description}&{method}&{email}&{signature_value}&{project}&{items}'.format(
                login=login,
                sum=sum,
                inv_id=inv_id,
                description=description,
                method=method,
                email=email,
                project='Shp_project=%s' % project_id,
                items='Shp_items=%s' % item_bought,
                signature_value='SignatureValue=%s' % signature
            )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Gavrilov, 2018-07-22
@thexaver

Shp_items=%s must come before the hash, i.e. before Shp_project=%s
All additional Shp_ must be alphabetical

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question