2

Status Update Notifications, statusUpdateNotification

I set Subscription Status URL in my APP in iTunes account like https://www.xxxxxx.xx/iospushnotification.php

I also successfully tested nscurl --ats-diagnostics https://www.xxxxxx.xx/iospushnotification.php

I also implemented php code in iospushnotification.php file to get JSON response

I purchased successfully Auto renewal Subscriptions Sandbox but I did not get any Status Update Notifications I get blank [] JSON response from apple server to my server.

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW6

Ankur Patel
  • 477
  • 5
  • 19
  • 2 years later, I'm having this issue as well. I don't suppose you found a fix? – Ben Dec 20 '17 at 17:02
  • Hi @Ankur Did you get the solution? – Niraj Jun 21 '18 at 09:04
  • @Niraj Actually Php Developer got response only latest data – Ankur Patel Jun 21 '18 at 09:19
  • $data = array( 'password' => $password, // secret key on IAP server 'receipt-data' => $receipt_data, // 'latest_receipt', base64 string 'exclude-old-transactions' => true ); $post = json_encode( $data ) ; $ch = curl_init() ; curl_setopt( $ch, CURLOPT_URL, $url ) ; curl_setopt( $ch, CURLOPT_POST, 1 ) ; curl_setopt( $ch, CURLOPT_POSTFIELDS, $post ) ; curl_setopt( $ch, CURLOPT_RETURNTRANSFER, TRUE ) ; – Ankur Patel Jun 21 '18 at 09:21
  • okay, thanks for replay, I will try with new apple account then It will works? – Niraj Jun 21 '18 at 09:21
  • $return = curl_exec ( $ch ) ; curl_close ( $ch ) ; $result = json_decode( $return, true ) ; switch ( $result[ 'status' ] ) { case 0 : return( 'Ok' ) ; break ; case 21006 : return( 'Expired' ) ; break ; // etc. } https://stackoverflow.com/questions/45595499/trouble-receiving-notifications-from-itunes-connect-about-iap-status-change-even – Ankur Patel Jun 21 '18 at 09:21
  • @Niraj Please visit this link bro https://stackoverflow.com/questions/45595499/trouble-receiving-notifications-from-itunes-connect-about-iap-status-change-even or merge above code in two comment you will get response – Ankur Patel Jun 21 '18 at 09:21
  • @AnkurPatel This code in nodeJS but I need php Code for that If you have then send me? – Niraj Jun 21 '18 at 09:39

1 Answers1

1

if anyone still cares 2 years later, I found a solution, assuming you're using PHP.

from the stackoverflow post Receive JSON POST with PHP we need to do something like this:

$appleData = file_get_contents('php://input');

then try to json_decode($appleData) from there.

(I've never had to do something so weird to get POST data before, but I've mostly used frameworks before; unfortunately, I do not currently have that luxury...)

Ben
  • 719
  • 6
  • 25