How do I send a migration receipt along with the product ID to my server?

How do I send a migration receipt along with the product ID to my server using the method HTTP POST

? Should I base64 encode the product ID?

I am getting this answer:

{"message": "21002: java.lang.IllegalArgumentException: propertyListFromString parsed the object, but there is still text in the line. Plis must contain only one top-level object. Line number: 1, column: 2478.", "error": 1 }

even after I encode the base64 encoded jump receipt ...

This is what I am doing:

NSString *bodyString = [NSString stringWithFormat:@"product_id=%@&receipt_data=%@",self.currentProductIdentifer,
[self.productReceiptData base64Encoding]];
NSData *bodyData = [bodyString dataUsingEncoding:NSUTF8StringEncoding
  allowLossyConversion:YES];
NSAssert(bodyData!=nil,@"HTTP Body is empty !");

//posting the data to server 
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:
  [NSURL URLWithString:inUrlString]
  cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:inData];  //inData is http body(bodyData) created above 
 // create the connection with the request // and start loading the data 
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 

      

+2


a source to share





All Articles