Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7427999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:40:28+00:00 2026-05-29T08:40:28+00:00

This question is following a previous one which i posted: Django Callback on Facebook

  • 0

This question is following a previous one which i posted:
Django Callback on Facebook Credits

So basically, I have a static HTML page with a button. Upon pressing of the button the purchase dialog for Facebook Credits should show up.

As shown in the Facebook blog post, here is my page link view the HTML source.

I have a view for the URL, which is the link that is registered in Facebook Developers. The view goes as followed:

def fb_credits_callback(request):
    #Data array that will be returned
    data = {
    }

    string = ''
    if request.method == 'GET':
        string = 'GET'
    elif request.method == 'POST':
        string = 'POST'

    send_mail(
        'TestDare Debug',
        'Received '+string+" request",
        'registration@my_domain.com',
        ['my_personal_email@gmail.com'],
        fail_silently=True
    )

    signed_request = request['signed_request']
    plain_request = parse_signed_request(signed_request, FACEBOOK_APP_ID)

Now naturally this is only a preliminary test (there’s much debugging to do later), but I don’t even receive the email when I click the button on my page. Which means that for some reason Facebook is not executing the callback to my application. If I execute a GET to that view I receive an email as expected.

Upon clicking the button I get the following error:

“There Was a Problem Processing Your Payment
Sorry, but we’re having trouble processing your payment. You have not been charged for this transaction. Please try again.”

If someone could help me trace why the callback is not working I would really appreciate it.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:40:29+00:00Added an answer on May 29, 2026 at 8:40 am

    The signed_request parameter is a simple way to make sure that the
    data you’re receiving is the actual data sent by Facebook. It is
    signed using your application secret which is only known by you and
    Facebook. If someone were to make a change to the data, the signature
    would no longer validate as they wouldn’t know your application secret
    to also update the signature.

    As i known Facebook’s python-sdk does not support parsing request parameter.

    Here is piece of code snippet for parsing “signed_request”.

    import base64
    import hashlib
    import hmac
    import simplejson as json
    
    def base64_url_decode(inp):
        padding_factor = (4 - len(inp) % 4) % 4
        inp += "="*padding_factor 
        return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/'))))
    
    def parse_signed_request(signed_request, secret):
    
        l = signed_request.split('.', 2)
        encoded_sig = l[0]
        payload = l[1]
    
        sig = base64_url_decode(encoded_sig)
        data = json.loads(base64_url_decode(payload))
    
        if data.get('algorithm').upper() != 'HMAC-SHA256':
            log.error('Unknown algorithm')
            return None
        else:
            expected_sig = hmac.new(secret, msg=payload, digestmod=hashlib.sha256).digest()
    
        if sig != expected_sig:
            return None
        else:
            log.debug('valid signed request received..')
            return data
    

    I know there is some cryptic code in base64_url_decode because translate, maketrans does not work that well with unicode strings. Anyways, if you have any questions, just drop a line in the commments below.

    Myabe you can find here more details.

    Thanks..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem follows on from a previous question . When I run the following
Okay, this is following on from my previous question reguarding performing a simple ajax
Following up on this question, I'm working on a large Delphi 7 codebase which
Following on from this question I now have code that can attach to a
This question is related to this previous one on how to replace accented strings
I'm writing this question with reference to this one which I wrote yesterday. After
Surprisingly I was only able to find one previous question on SO about this
This is a question following my previous problem, you can find it right there
This is related question to my previous question but different one. After searching a
As in my previous question I have the following problem. I have a matrix

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.