In App Purchase Receipt verification within app
<p>I want to verify the transaction receipt within my app,</p>

<p>Here is my code,</p>

<pre><code>- (void)recordTransaction:(SKPaymentTransaction *)transaction {

    NSData *receiptData = [NSData dataWithData:transaction.transactionReceipt];

    NSString *encodedString = [Base64 encode:receiptData];

     NSURL *url = [NSURL URLWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"];

    ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];

    [request setPostValue:encodedString forKey:@"receipt-data"];

    [request setRequestMethod:@"POST"];

    [request setDelegate:self];

    [request startAsynchronous];

}
</code></pre>

<p>I am getting output:  </p>

<p>{"status":21002, "exception":"java.lang.NullPointerException"}</p>

<p>Can someone help me to get proper receipt verification?</p>
