PHP in Apple purchase order verification

Source: Internet
Author: User

/** * 21000 APP store cannot read the JSON object you provided * 21002 receipt-data domain data is problematic * 21003 receipt cannot be verified * 21004 provided by shared secret does not match your account The shared secret * 21005 Receipt server is currently unavailable * 21006 receipt is legitimate, but the subscription has expired. When the server receives this status code, the receipt data is still decoded and sent together * 21007 receipt is a sandbox receipt, but is sent to the production System authentication Service * 21008 receipt is production receipt, But the verification service sent to the sandbox * * $receipt _data The payment voucher returned by Apple * $sandbox to 1 o'clock for the test address, and 0 for the trial address*/functionAcurl ($receipt _data,$sandbox=0){    //Small Ticket information    $POSTFIELDS=Array("Receipt-data" =$receipt _data); $POSTFIELDS= Json_encode ($POSTFIELDS); //official purchase address sandbox purchase address    $url _buy= "Https://buy.itunes.apple.com/verifyReceipt"; $url _sandbox= "Https://sandbox.itunes.apple.com/verifyReceipt"; $url=$sandbox?$url _sandbox:$url _buy; //Simple curl.    $ch= Curl_init ($url); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_postfields,$POSTFIELDS); $result= Curl_exec ($ch); Curl_close ($ch); $data= Json_decode ($result,true); //$data [' status ']==0 success//$data [' Receipt '] [' In_app '][0][' transaction_id '] apple order number//$data [' Receipt '] [' In_app '  ][0][' product_id ']; Commodity price    return $data; }

PHP in Apple purchase order verification

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.