iOS Question in-app Purchase Fails

aaronk

Well-Known Member
Licensed User
Hi,

I am using the iStore library to create an in-app Consumable purchase.

When I request for the payment it then pops up asking for my AppleID. I used a test AppleID (not my developer AppleID)

I made the purchase, but the success = false after the payment was made. It still logged the purchase information (ProductIdentifier, TransactionDate, TransactionIdentifier)

I then closed the app and re-opened the app and requested the payment again.

This time when it prompt me for the payment I clicked cancel. (didn't follow though with the payment.)

The sub MyStore_PurchaseCompleted triggered and it still showed the ProductIdentifier, TransactionDate, TransactionIdentifier and success is still false.

I did add the code:
B4X:
If Success = False Then
        Log(Product.Error)
    End If
to the purcahseCompleted sub.

It also logs:
B4X:
<B4IExceptionWrapper: Error Domain=SKErrorDomain Code=2 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}>
Keep getting the same error (even if I sign into my test account) and following though with the payment.

The ProductIdentifier changes each time as well.

MyStore.CanMakePayments logs True, so I know my device can make in-app purchases.

Any ideas on why it keeps failing the purchase, even knowing my device has internet connection on it ?
 
Last edited:

aaronk

Well-Known Member
Licensed User
Got it to work.

I had to add a sandbox user in Apple App Store Connect.

I also used a different phone than my development iPhone so nothing can be mapped to my AppleID.

Now it shows success = True.
 
Top