D
D
Danil Kislov2021-06-04 18:11:21
Payment systems
Danil Kislov, 2021-06-04 18:11:21

Why doesn't WebHook CloudPayments work?

A payment is made through CloudPayments acquiring, a check is created, and a link to this check should be sent via a webhook to my server. I connected the webhook, but the notification log in the personal account on the acquirer's website says that the server returned the code 500. I tried to send the same request myself - everything works. Support confirmed: if sent manually, it works, but the service gives 500 and everything works correctly on their side. Link to the acquirer docks - https://developers.cloudkassir.ru/#uvedomleniya . Log from the system log -

Request: #35 V2 GET scooteradminpanel. ru / API / SetTransactionReceipt /? Id = xcFXqcG & DocumentNumber = 2568 & SessionNumber = 31 & Number = 212 & FiscalSign = 4089338079 & DeviceNumber = 01801810027237 & RegNumber = 0005269331008904 & FiscalNumber = 9287440300810774 & Inn = 3528323904 & Type = Income & Ofd = LLC «PETER-SERVICE Spetstechnology» & Url = https://ofd.ru/rec/3528323904/ 0005269331008904/928... 18:43:00&InvoiceId=&AccountId=4535&Receipt={"TinyUrl":"xcFXqcG","Email":null,"Phone":"+79858803440","CalculationPlace":" http://sota .world/","SettlePlace":"117342, Moscow, st. Butlerova, 17B","Items":[{"Label":"Account replenishment","Price":250.0,"Quantity":1.0,"Amount":250.0,"Department":null,"Vat":null, "EAN13":null,"AgentSign":null,"Method":0,"Object":0,"MeasurementUnit":null,"Code":null,"CalcVat":null,"VatDescription":null,"MethodName ":null,"ObjectName":null,"AgentDescription":"","AgentData":null,"PurveyorData":null,"Excise":null,"CountryOriginCode":null,"CustomsDeclarationNumber":null,"ProductCodeData" :null}],"TaxationSystem":1,"Amounts":{"Electronic":250.0,"Cash":0.0,"AdvancePayment":0.0,"https://qr.cloudpayments.ru/receipt?q=t%3d20210602... "PETER-SERVICE Special Technologies"","OfdUrl":"ofd.ru","OfdInn":"7841465198","VatTotals": [{"Vat":null,"Label":null,"Amount":0.0}],"TaxationSystemDescription":"USN (Income)"}&CalculationPlace= sota.world/&SettlePlace=117342 , Moscow, Butlerova St., 17B
Response: The remote server returned an error: (500) Internal Server Error.


My method code is
class SetTransactionReceipt(APIView):
    @swagger_auto_schema(operation_description="Закрыть заказ")
    def get(self, request):
        data = request.query_params
        if 'TransactionId' in data:
            q = request.query_params['n']
            t = '{' + q[q.index(',') + 1:]
            url = json.loads(t)['ReceiptOfdUrl']
            new_link = ReceiptUrl(transaction_id=data['TransactionId'], link=url)
            new_link.save()
        else:
            return HttpResponse(json.dumps({'code': 1}))
        return HttpResponse(json.dumps({'code': 0}))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-06-04
@HooinKema

Set up logging so that backtrace is sent to your mail when an error occurs, and analyze it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question