Apple在应用内购买验证.NET Java 21002例外中的定期付款

时间:2012-10-03 12:21:30

标签: iphone in-app-purchase

我们正在尝试验证在iOS中进行的RECURRING应用内付款的收据。

参考堆栈上的早期问题(http://stackoverflow.com/questions/11085847/keep-getting-21002-java-lang-nullpointerexception-on-apples-verifyreceipt),我设法使用以下代码发送一个由我们的收据和sharedSecret密钥组成的JSON对象,但是我们得到了可怕的{“status”:21002,“exception”:“java.lang.NullPointerException”}错误

Dim json As String ="{'receipt-data':'base64encoded receipt data','password':'YYYY'}"

Dim webRequest = System.Net.HttpWebRequest.Create("https://sandbox.itunes.apple.com/verifyReceipt")
    webRequest.ContentType = "text/plain"
    webRequest.Method = "POST"
    Dim byteArray As Byte() = Encoding.UTF8.GetBytes(json)
    webRequest.ContentLength = byteArray.Length
    Using stream = webRequest.GetRequestStream()
        stream.Write(byteArray, 0, byteArray.Length)
        stream.Flush()
    End Using

    Dim resp = webRequest.GetResponse()
    If resp IsNot Nothing Then
        Using sr = New System.IO.StreamReader(resp.GetResponseStream())
            Dim result = sr.ReadToEnd().Trim()
            ' always getting '21002' 'java.lang.NullPointerException'

            Response.Write(result.ToString())
        End Using
    End If

任何帮助表示赞赏!

0 个答案:

没有答案