在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
// 正式环境验证地址 $ios_verify_url = 'https://buy.itunes.apple.com/verifyReceipt'; // 测试环境验证地址 $ios_sandbox_verify_url = 'https://sandbox.itunes.apple.com/verifyReceipt'; $defaults = array( CURLOPT_POST => 1, CURLOPT_HEADER => 0, CURLOPT_URL => $ios_sandbox_verify_url, CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 60, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_POSTFIELDS => $receipt // 苹果购买后返回的票据信息 ); $ch = curl_init(); curl_setopt_array($ch, $defaults); $result = curl_exec($ch); $errno = curl_errno($ch); $errmsg = curl_error($ch); curl_close($ch); // 判断时候出错,抛出异常 if ($errno != 0) { throw new Exception($errmsg, $errno); } $object = json_decode($result); // 判断返回的数据是否是对象 if (!is_object($object) || !isset($object->status)) { throw new Exception('Invalid response data'); } if($object->status === 0) { // 认证成功 $return = array( 'status' => 1, 'receipt' => null, 'expires_date_ms' => null, 'remote_server_code' => $object->status ); if (isset($object->latest_receipt) && !empty($object->latest_receipt)) { // 如果是订阅购买,需要将票据保存到数据库中 // 如果苹果返回了这个值,那么需要同步将这个值更新到数据库中 } if (isset($object->latest_receipt_info) && !empty($object->latest_receipt_info)) { // 获取过期时间 $last_receipt_info = end($object->latest_receipt_info); $expires_date_ms = $last_receipt_info->expires_date_ms / 1000; } // 其他操作 } else { return array( 'status' => 0, 'receipt' => null, 'expires_date_ms' => null, 'remote_server_code' => $object->status ); } 或者 $receipt = 'MIIigAYJKoZIhvcNAQcCoIIicTCCIm0CAQExCzAJBgUrDgMCGgUAMIISMQYJKoZIhvcNAQcBoIISIgSCEh4xghIaMAoCARQCAQEEAgwAMAsCAQ4CAQEEAwIBWTALAgEZAgEBBAMCAQMwDQIBAwIBAQQFDAMxLjAwDQIBCgIBAQQFFgMxMi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3lPNNiiPvl4/2vIB+x9OYOLUyDTOMSxv5pPCmv/K/xZpwUJfBdAVhEedNO3iyM7R6PVbyTi69G3cN8PReEnyvFteO3ntRcXqNx+IjXKJdXZD9Zr1KIkIxH3oayPc4FgxhtbCS+SsvhESPBgOJ4V9T0mZyCKM2r3DYLP3uujL/lTaltkwGMzd/c6ByxW69oPIQ7aunMZT7XZNn/Bh1XZp5m5MkL72NVxnn6hUrcbvZNCJBIqxw8dtk2cXmPIS4AXUKqK1drk/NAJBzewdXUhMYIByzCCAccCAQEwgaMwgZYxCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkCCBhZQyFydJz8MAkGBSsOAwIaBQAwDQYJKoZIhvcNAQEBBQAEggEAn61JeH/wwbnZisQ0ObwJWKZmGF7bdscE0/OHF4ht9RiyjCP4mN3M/oHZgb47zIUqZ/fojCAyO52BL0HtlpJ01M8lbzk0PmyzfHYmhEP3u0d0weVZ+8HYALwj3n7aWmreagDo2hHXKBAznBn+8Y0zms+qRoA35jkZOEGIZ3i/e/pFJelyFqIruAw1LiR/xFUaJY9fAfoQTN+aFaUQTkM3RFh05MeOZiLRGNziYGY/zELBxw4jL/3Ax1MezlcvhtaMYMyH5ef9XN+M+S925NhCDjm/XgwC0rx6XCaMSG96aUnvzXfu9wplYXiruycCqtdjV7HzV0CQoeBzZemSWvcE1A=='; validate_receipt($receipt, false); function validate_receipt($receipt_data, $sandbox_receipt = FALSE) { if ($sandbox_receipt) { $url = "https://sandbox.itunes.apple.com/verifyReceipt"; } else { $url = "https://buy.itunes.apple.com/verifyReceipt"; } $ch = curl_init($url); $data_string = json_encode(array( 'receipt-data' => $receipt_data, 'password' => '501692890fec42cab66dfc10d3b7xxxx',//订阅购买需要认证密码 )); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); $output = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if (200 != $httpCode) { die("Error validating App Store transaction receipt. Response HTTP code $httpCode"); } $decoded = json_decode($output, TRUE); var_dump($decoded);exit; }
|
2022-08-17
2022-11-06
2022-08-17
2022-08-14
2022-07-18
请发表评论