Question

Complete transaction in didFinishLaunchingWithOptions?

  • 18 June 2022
  • 1 reply
  • 101 views

Badge +2

Imagine that my app crashes just after a successful payment. I want to know purchase to finish when my app restarts.

I don’t see in the docs how to do it using RevenueCat.

 

I was using this code:

 

SwiftyStoreKit.completeTransactions(atomically: true) { purchases in	    for purchase in purchases {	        switch purchase.transaction.transactionState {	        case .purchased, .restored:	            if purchase.needsFinishTransaction {	                // Deliver content from server, then:	                SwiftyStoreKit.finishTransaction(purchase.transaction)	            }	            // Unlock content	        case .failed, .purchasing, .deferred:	            break // do nothing	        }	    }}

 

Thanks


1 reply

Badge

Hi @ThierryB 

 

Sorry for the late response. I see that you are using the SwiftyStoreKit, have you checked already the documentation for migrating to RevenueCat. https://docs.revenuecat.com/docs/swiftystorekit#app-startup

 

Once you have configured your customer after a crash you will be able to check the purchases made and if they are complete so you can finish whatever steps are remaining then.

 

Hope it helps

 

For future reference if you need quicker response times you can email us at support@revenuecat.com 

 

 

 

 

Reply