Django Callback on Facebook Credits

288 views Asked by At

I would like to use Facebook Credits with my Django Application.

In the Facebook Credits documentation, there is only a sample for the callback page in PHP (https://developers.facebook.com/blog/post/489/).

However, I would like to develop a callback in my Django application. I already created a view for the callback, but now I have no idea what Facebook sends me and how should I parse it.

I suppose it is some kind of POST HTTP request with some parameters I should parse, but how?

Thank you for all input.

1

There are 1 answers

2
Chris Lacasse On BEST ANSWER

They send you a signed request which you need to parse. I'd suggest reading the rest of the facebook documentation if you're confused about what that means.

This guy has already done the php to python conversion for you: http://sunilarora.org/parsing-signedrequest-parameter-in-python-bas

Once you've parsed what they sent you, do exactly what they do in the php script. Then, you send json back to them. At the end of your view:

def fb_credits_callback(request):
    # parse with your parse function
    # handle request
    return HttpResponse(json.dumps(data))