iosin-app-purchasereceipt

I have a strange problem with server receipts validation


I'm developing an App that supports IAP and I want to use my server to verify receipts.

When I was sending data to my server to verify the receipts sometimes it works, but sometimes I've got an error like this. I tried the same data with postman it works fun.

list version="1.0">
<dict>
<key>pings</key>
<array></array>
<key>metrics</key>
<dict>
  <key>dialogId</key><string>exception</string>
  <key>message</key><string>exception_message</string>
  <key>eventType</key><string>dialog</string>
  <key>actionUrl</key><string>buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/verifyReceipt</string>
</dict>
<key>failureType</key><string></string>
<key>customerMessage</key><string>exception_message</string>
<key>m-allowed</key><false/>
<!--
Copy this when sending an error email or filing a radar.

Exception:
java.lang.reflect.InvocationTargetException Back Trace:
java.lang.reflect.InvocationTargetException
    at com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:281)
    at com.webobjects.appserver._private.WOActionRequestHandler.handleRequest(WOActionRequestHandler.java:167)
    at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1880)
    at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1136)
    at com.apple.jingle.foundation.appserver.MZSimpleApplication.simpleDispatchRequest(MZSimpleApplication.java:399)
    at com.apple.jingle.foundation.appserver.MZSimpleApplication.dispatchRequest(MZSimpleApplication.java:350)
    at com.apple.jingle.appserver.MZApplication.dispatchRequest(MZApplication.java:1482)
    at com.apple.jingle.commercelogic.MZFraudMessagingApplication.dispatchRequest(MZFraudMessagingApplication.java:111)
    at com.apple.jingle.app.finance.Application.dispatchRequest(Application.java:1044)
    at com.apple.jingle.app.finance.Application.dispatchRequest(Application.java:859)
    at com.apple.jingle.foundation.appserver.MZWorkerThread.dispatchRequest(MZWorkerThread.java:157)
    at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:571)
    at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:747)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IndexOutOfBoundsException
    at java.io.PushbackInputStream.read(PushbackInputStream.java:170)
    at com.webobjects.appserver._private.WOChunkedInputStream.readBytes(WOChunkedInputStream.java:238)
    at com.webobjects.appserver._private.WOChunkedInputStream.read(WOChunkedInputStream.java:60)
    at com.webobjects.foundation.NSData.&lt;init&gt;(NSData.java:250)
    at com.webobjects.appserver._private.WOInputStreamData._extractBytesFromInputStream(WOInputStreamData.java:113)
    at com.webobjects.appserver._private.WOInputStreamData.bytesNoCopy(WOInputStreamData.java:157)
    at com.webobjects.foundation.NSData._bytesNoCopy(NSData.java:499)
    at com.webobjects.appserver.WOMessage.contentString(WOMessage.java:852)
    at com.apple.jingle.util.MZAffiliateRequestUtil.requestUriHasAffiliateDataThatRequiresACookieSet(MZAffiliateRequestUtil.java:44)
    at com.apple.jingle.redirect.MZRedirector$2.requestIsBountiable(MZRedirector.java:320)
    at com.apple.jingle.redirect.MZRedirector$2.process(MZRedirector.java:235)
    at com.apple.jingle.redirect.MZRedirector.redirectForRequest(MZRedirector.java:94)
    at com.apple.jingle.app.store.MZWebLinkableDirectAction.performActionNamed(MZWebLinkableDirectAction.java:44)
    at com.apple.jingle.app.finance.DirectAction.performActionNamed(DirectAction.java:414)
    at com.webobjects.appserver._private.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:269)
    ... 13 more
    Extra Info:
nullNote that double hyphens have silently been truncated to single hyphens in this
comment section.
-->
<key>dialog</key>
<dict><key>m-allowed</key><false/>
<key>message</key><string>Your request is temporarily unable to be processed.</string>
<key>explanation</key><string>Please try again later.</string>
<key>defaultButton</key><string>ok</string>
<key>okButtonString</key><string>OK</string>
<key>initialCheckboxValue</key><true/></dict>
</dict>
</plist>

Solution

  • This error may appear if you use the wrong URL for sandbox testing.

    Production URL: https://buy.itunes.apple.com/verifyReceipt

    Sandbox URL: https://sandbox.itunes.apple.com/verifyReceipt