Closed Ralle closed 1 year ago
I see now that this is because there is "nothing to do" as per the code. I am trying to find the best way of getting the transaction FROM the purchase. It's not easy to find a solution that works for iOS as well as Android.
I now added this code:
if (
transaction.transactionId ===
CdvPurchase.AppleAppStore.APPLICATION_VIRTUAL_TRANSACTION_ID
) {
transaction = transaction.parentReceipt.lastTransaction();
}
But what I really just want, is the valid transaction after a purchase, regardless of whether the purchase somehow reactivates an existing thing or is a new thing.
Can't you just use the CdvPurchase.store.localReceipts
property to figure out the latest transaction?
Can you give more context on where you are using this?
The CdvPurchase.AppleAppStore.APPLICATION_VIRTUAL_TRANSACTION_ID
corresponds to the application download (StoreKit generates a receipt to validate the download of the application, gives extra info as well)
Ah.. It's been forever since I posted this. I have tinkered every day since. Learned how important the Validator is. I kept getting presented an expired receipt, not anymore since I setup validation.
I still feel like the offer.order()
should give you something that resolved to the actual final transaction ID if nothing else.
Observed behavior
On iOS a transaction with ID
appstore.application
is created when I subscribe, unsubscribe and subscribe.Reproduce:
transactionId
)transactionId
="appstore.application"
)This is the code I am using to handle buying:
The resulting transaction is invalid on iOS on second purchase.
Expected behavior
All transactions regardless of number of times subscribed should be valid.
System Info
Output of
cap ls
.First subscribe:
Unsubscribe, reload page, then second subscribe: