Im implementing a payment module called mercadopago (like paypal) and I need to handle a http request that is send to my site when someone make a payment(IPN) with information in in an url of this type:
POST /notifications?topic=payment&id=identificador-de-notificacion-de-pago
(mercadopago send a POST request to my site every time a payment impact)
but i cant make it match with the django url system. i tried the following url:
url(r'^notifications$', 'views.notifications', name='notifications'),
I tried with diferent combination and consulted the apache log file and threw me error 500
The view that handdle the url is the following:
@csrf_exempt
def IpnProxy(request, **kwargs):
mp = mercadopago.MP("*********", "*********")
paymentInfo = mp.get_payment_info(kwargs["id"])
if paymentInfo["status"] == 200:
return paymentInfo["response"]
else:
return None
I dont know if have to configure singals or something else.
Maybe im getting it wrong but mercadopago make the post request to my server, I cant change that. Here is their documentation http://developers.mercadopago.com/documentation/instant-payment-notifications?lang=en_US And here is their example project in python: https://github.com/mercadopago/sdk-python/blob/master/examples/instant-payment-notifications/receive-ipn.py