I adjust the payment on the site through interkassu. Interkassa after successful payment by the user, sends a notification of payment to the server. The signature is formed by gluing all the request fields and pasting the secret key to the end, followed by encoding in md5 or sha256 into a byte-array. The form:
<input type="hidden" name="ik_am" value="1.00"> <input type="hidden" name="ik_act" value="process"> <input type="hidden" name="ik_co_id" value="571624f33d1eafb1528b456b"> <input type="hidden" name="ik_co_prs_id" value="307447812424"> <input type="hidden" name="ik_co_rfn" value="0.94"> <input type="hidden" name="ik_cur" value="RUB"> <input type="hidden" name="ik_desc" value="Оплата товара"> <input type="hidden" name="ik_inv_crt" value="2013-03-17 17:35:33"> <input type="hidden" name="ik_inv_id" value="5632156"> <input type="hidden" name="ik_inv_prc" value="2013-03-17 17:36:13"> <input type="hidden" name="ik_inv_st" value="success"> <input type="hidden" name="ik_pm_no" value="70"> <input type="hidden" name="ik_ps_price" value="20"> <input type="hidden" name="ik_pw_via" value="yandex"> <input type="hidden" name="ik_trn_id" value="14533"> <input type="hidden" name="ik_sign" value="oVAOevI3mWrcvrjB4j/ySg=="> variables = "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s" % ( form.cleaned_data['ik_am'], form.cleaned_data['ik_act'], form.cleaned_data['ik_co_id'], form.cleaned_data['ik_co_prs_id'], form.cleaned_data['ik_co_rfn'], form.cleaned_data['ik_cur'], form.cleaned_data['ik_desc'], form.cleaned_data['ik_inv_crt'], form.cleaned_data['ik_inv_id'], form.cleaned_data['ik_inv_prc'], form.cleaned_data['ik_inv_st'], form.cleaned_data['ik_pm_no'], form.cleaned_data['ik_ps_price'], form.cleaned_data['ik_pw_via'], form.cleaned_data['ik_trn_id'] ) For pasting, I use hash_key = md5(variables.encode('utf-8')).digest() for hashing. But I get the error:
'ascii' codec can't decode byte 0xeb in position 0: ordinal not in range (128)
Help solve the problem.
form.cleaned_dataandvariables. The code itself, which turns all this, would not hurt either. - Lebedev Ilya