×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    59

    Re: IAP Ticket Verification API not working in production mode

    Here is the corrected code that I'm now successfully using with Django/Python. Maybe it will help somebody.

    Code:
    def nokia_ticket_is_valid(ticket):
        """ Sends the ticket to Nokia to see if it is valid """
        
        validationRequest  = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' 
        validationRequest += '<PurchaseVerificationRequest xmlns="http://payment.ovi.com/iap">'
        validationRequest += '<Binary>'
        validationRequest += ticket
        validationRequest += '</Binary>'
        validationRequest += '</PurchaseVerificationRequest>'
        
        headers = {'Content-type': 'application/x-www-form-urlencoded', 'charset': 'UTF-8'}
        body = urllib.urlencode({'content': validationRequest})
        
        conn = httplib.HTTPSConnection('payment.ovi.com')
        conn.request('POST',
                     'https://payment.ovi.com/iap/1.0/purchases/verify?method=GET',
                     body,
                     headers)
        response = conn.getresponse()
        
        if response.status == 200:
            # Check data (must contain OK)
            xml_data = response.read()
            root_element = fromstring(xml_data)
            result = root_element.attrib.get("result")
    
            if result == 'OK':
                return True, result
            else:
                return False, result
        else:
            return False, 'Http response ' + str(response.status)

  2. #17
    Nokia Developer Expert
    Join Date
    Oct 2007
    Posts
    441

    Re: IAP Ticket Verification API not working in production mode

    i think the difference you observed is coincident - please check other symbols that may happen in Base64

    Using standard Base64 in URL requires encoding of '+', '/' and '=' characters into special percent-encoded hexadecimal sequences ('+' = '%2B', '/' = '%2F' and '=' = '%3D') ...wikipedia

  3. #18
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    59

    Re: IAP Ticket Verification API not working in production mode

    You're right. That why I now encode the whole body using urlencode
    Code:
    body = urllib.urlencode({'content': validationRequest})

Similar Threads

  1. App is not working in offline mode
    By tarun.WRT in forum Symbian
    Replies: 1
    Last Post: 2011-01-08, 11:13
  2. [RDA] T9 Predictive Text mode working as numeric mode in E71
    By sameerbkamble in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 1
    Last Post: 2009-03-30, 12:22
  3. E61 Default Input Mode Not Working
    By pistha in forum Symbian
    Replies: 7
    Last Post: 2009-01-21, 14:39
  4. MY Input mode key selection was not working
    By sriramadasu in forum Symbian
    Replies: 0
    Last Post: 2007-01-01, 06:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×