IAP Payment Sheet Failed (AMSErrorDomain Code=6)

Hi, I have an app in app store with subscription feature available. IAP works perfectly fine and I have no issues till data. One of my user has reached out to me with an issue, they are claiming to have an IAP subscription made. User also send me a screen shot with the active subscription they have (Settings --> Account --> Subscriptions). My App is there (Screen Shot attached, Next Billing Date: May 05 2022). But in my server, i only find the transaction error below. User did try to restore purchase, but it did not work. I am sure restore transaction works, as other users have used it recently and works fine. Can anyone let me know why the transaction for this user is not fetched and what this error means.

Error Domain=SKErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x283ef5c80 {Error Domain=ASDErrorDomain Code=907 "Unhandled exception" UserInfo={NSUnderlyingError=0x283efa3d0 {Error Domain=AMSErrorDomain Code=6 "Payment Sheet Failed" UserInfo={NSLocalizedDescription=Payment Sheet Failed, NSLocalizedFailureReason=Payment sheet cancelled}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}

In my case, the payment sheet opens after the automatic subscription payment request,

but the same error(Error=907) occurred when I pressed the cancel button on the payment sheet.

There was an error that did not open the sheet when I requested payment again after cancellation, but the problem was an error caused by the previous transaction not being completed and remaining in the queue.

Before requesting payment to SK Payment Queue, it works without any problems after adding code that forces all transactions to be terminated and removed.

Before you request a restore transaction, check if there is an unfinished transaction.

The code below was written before the transaction request.

for transaction in SKPaymentQueue.default().transactions {

      switch transaction.transactionState {

      default :

         SKPaymentQueue.default().finishTransaction(transaction)

         SKPaymentQueue.default().remove(self)

         break;

      }

    }

IAP Payment Sheet Failed (AMSErrorDomain Code=6)
 
 
Q