Communication with the App Store is structured as JSONdictionaries, as defined in RFC 4627. To verify the receipt,perform the following steps:
Retrieve the receipt data and base64 encode it (using the RFC 4648form of base64). Use the appStoreReceiptURL
NSBundle
If the appStoreReceiptURL
transactionReceipt
Create a JSON object with a single key named receipt-data
{ |
"receipt-data" : "(receipt bytes here)" |
} |
Send the JSON object to the App Store using an HTTP POST request.The URL for the store is https://buy.itunes.apple.com/verifyReceipt
.
The response received from the App Store is a JSON object with thekeys status
receipt
.(When validating an auto-renewable subscription, the responsecontains additional keys, as described in
{ |
"status" : 0, |
"receipt" : { (receipt here) } |
} |
If the value of the status
0
,this is a valid receipt. If the value is anything otherthan 0
,this receipt is invalid.
The value of the receipt
沙盒測(cè)試的時(shí)候地址是:https://sandbox.itunes.apple.com/verifyReceipt
下面這個(gè)差不多就是上面官方文檔的中文介紹版本:
Verify an App Store Transaction Receipt【蘋果服務(wù)端驗(yàn)證一個(gè)應(yīng)用程序商店交易收據(jù)有效性】
http://blog.csdn.net/saindy5828/article/details/6414014
public int verifyReceipt( byte[] receipt){
InAppPurchurse 驗(yàn)證訂單,這個(gè)提供了IOS客戶端和WEB PHP端的代碼:
http://hi.baidu.com/492437598/item/d8df142af5b8cfcbddf69a19
下面這個(gè)也類似,也有代碼
iPhone/iPad的IAP防破解之第三方服務(wù)器二次驗(yàn)證(附代碼)
http://www.anagyris.com/iphone_ipad_iap_anti_crack.html
http://www.360doc.com/content/12/0815/16/1440938_230331166.shtml
下面這個(gè)分析的比較詳細(xì)
iPhone In App Purchase購(gòu)買完成時(shí)驗(yàn)證transactionReceipt
http://www.cnblogs.com/eagley/archive/2011/06/15/2081577.html
============
客戶端驗(yàn)證
下面李華明的這個(gè)是在客戶端做驗(yàn)證:
【iOS-iap防護(hù)】驗(yàn)證用戶付費(fèi)收據(jù)!拒絕iap Cracker!! http://xiaominghimi.blog.51cto.com/2614927/829760
-----------------
APPSTORE 官方文檔
About In-App Purchase https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction.html
Receipt Validation Programming Guide
1-1)Validating Receipts Locally
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html#//apple_ref/doc/uid/TP40010573-CH1-SW2
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1
2-1)Validating Receipts With the AppStore(使用這個(gè)哈)
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1
2-2)“Receipt Fields”
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1
聯(lián)系客服