File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -298,9 +298,31 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran
298298 } break ;
299299 case SKPaymentTransactionStateRestored: {
300300 printf (" status transaction restored!\n " );
301+ String transactionId = String::utf8 ([transaction.transactionIdentifier UTF8String ]);
301302 InAppStore::get_singleton ()->_record_purchase (pid);
302303 ret[" type" ] = " restore" ;
303304 ret[" result" ] = " ok" ;
305+ ret[" transaction_id" ] = transactionId;
306+
307+ NSData *receipt = nil ;
308+ int sdk_version = [[[UIDevice currentDevice ] systemVersion ] intValue ];
309+
310+ NSBundle *bundle = [NSBundle mainBundle ];
311+ // Get the transaction receipt file path location in the app bundle.
312+ NSURL *receiptFileURL = [bundle appStoreReceiptURL ];
313+
314+ // Read in the contents of the transaction file.
315+ receipt = [NSData dataWithContentsOfURL: receiptFileURL];
316+
317+ NSString *receipt_to_send = nil ;
318+
319+ if (receipt != nil ) {
320+ receipt_to_send = [receipt base64EncodedStringWithOptions: 0 ];
321+ }
322+ Dictionary receipt_ret;
323+ receipt_ret[" receipt" ] = String::utf8 (receipt_to_send != nil ? [receipt_to_send UTF8String ] : " " );
324+ receipt_ret[" sdk" ] = sdk_version;
325+ ret[" receipt" ] = receipt_ret;
304326 [[SKPaymentQueue defaultQueue ] finishTransaction: transaction];
305327 } break ;
306328 case SKPaymentTransactionStatePurchasing: {
You can’t perform that action at this time.
0 commit comments