I'm trying to handle the refund in-app purchase for iOS. But I couldn't find a clear guidelines to do this.
So I have a membership type in-app purchase feature, where the user credentials is not necessarily ties to the itunes account.
Is there some kind of identifier that I can refer to when someone make a purchase, and have the same identifier when they request a refund through apple?
Also, do we get instant notification when they refund it? I need to cancel the membership immediately.
Thanks!
I ended up storing the receipt string and running cron to go through the transactions and look for cancellation field.
$url = "https://buy.itunes.apple.com/verifyReceipt";
$data = json_encode(array('receipt-data' => $receipt));
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
$errno = curl_errno($ch);
$errmsg = curl_error($ch);
curl_close($ch);
if ($errno != 0) {
throw new Exception($errmsg, $errno);
}
return $response;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With