Problem IOS 14 Purchase buySubscription and Restore Purchases

Hi Guys,

I am developing IOS purchases on a physical device.
Everything was working fine until I upgrade to IOS 14 version.

Device: Physical iPhone 6
IOS: 14

The problem:
  1. Before making a purchase I send to verify the restore purchases with my backend

  2. I check that the user does not have active subscriptions

  3. If the user does not have active subscriptions, I will send him to buy a subscription

  4. The purchase popup never appears

This happens with users who have already made a purchase before.
I tried removing the call from the restore purchases and it works fine without this one.


Code Block
RCT_EXPORT_METHOD(getAvailableItems:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject) {
[self addPromiseForKey:@"availableItems" resolve:resolve reject:reject];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}


Code Block
-(void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue { //////// RESTORE
NSLog(@"\n\n\n paymentQueueRestoreCompletedTransactionsFinished \n\n.");
NSMutableArray* items = [NSMutableArray arrayWithCapacity:queue.transactions.count];
for(SKPaymentTransaction *transaction in queue.transactions) {
if(transaction.transactionState == SKPaymentTransactionStateRestored
|| transaction.transactionState == SKPaymentTransactionStatePurchased) {
[self getPurchaseData:transaction withBlock:^(NSDictionary *restored) {
[items addObject:restored];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}];
}
}
[self resolvePromisesForKey:@"availableItems" value:items];
}

Code Block
-(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {
dispatch_sync(myQueue, ^{
[self rejectPromisesForKey:@"availableItems" code:[self standardErrorCode:(int)error.code]
message:error.localizedDescription error:error];
});
NSLog(@"\n\n\n restoreCompletedTransactionsFailedWithError \n\n.");
}


Code Block
RCT_EXPORT_METHOD(buyProduct:(NSString*)sku
andDangerouslyFinishTransactionAutomatically:(BOOL)finishAutomatically
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject) {
pendingTransactionWithAutoFinish = finishAutomatically;
SKProduct *product;
@synchronized (validProducts) {
for (SKProduct *p in validProducts) {
if([sku isEqualToString:p.productIdentifier]) {
product = p;
break;
}
}
}
if (product) {
[self addPromiseForKey:product.productIdentifier resolve:resolve reject:reject];
SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];
} else {
if (hasListeners) {
NSDictionary *err = [NSDictionary dictionaryWithObjectsAndKeys:
@"Invalid product ID.", @"debugMessage",
@"E_DEVELOPER_ERROR", @"code",
@"Invalid product ID.", @"message",
sku, @"productId",
nil
];
[self sendEventWithName:@"purchase-error" body:err];
}
reject(@"E_DEVELOPER_ERROR", @"Invalid product ID.", nil);
}
}


It is the library react-native-iap that I am using


Answered by xingyifeng in 643328022
Same question
  1. If the user has purchased the product but it expires,

  2. At this point, click restore to buy,

  3. Click buy, he will not pop up the Apple Pay page

A look at the code shows that Apple is processing the resume purchase order, and if you've only bought it once before, Apple will quickly process it. But I have more than eighty orders and I have to wait for two minutes
Accepted Answer
Same question
  1. If the user has purchased the product but it expires,

  2. At this point, click restore to buy,

  3. Click buy, he will not pop up the Apple Pay page

A look at the code shows that Apple is processing the resume purchase order, and if you've only bought it once before, Apple will quickly process it. But I have more than eighty orders and I have to wait for two minutes
same bugs, apple review reject our app, have you fix it?
My App is also rejected but I am using In-App Purchase Non-Consumable. Apple still rejected it saying this below:

Please help me on this matter. I am using SwiftyStoreKit

Code Block We found that your in-app purchase products exhibited one or more bugs when reviewed on iPhone running iOS 14.2 on Wi-Fi.
- Specifically, the app loaded indefinitely when we tried to unlock all the tables. 
Next Steps
When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead.
Regarding purchasing in-app purchases, we continue to be unable to buy the full version of the app. When we tap on the button to buy, the app continues to load indefinitely.


Nothing yet guys. I didn't fix it yet
Same problem!
The user subscribes to testfly, after automatic cancellation it is not possible to subscribe again.
Problem IOS 14 Purchase buySubscription and Restore Purchases
 
 
Q