Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Amazon paywalls after purchasing #1053

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Apr 25, 2024

In PurchaseCompleted we are passing a Flutter's StoreTransaction in the callback. This is very confusing but:

  • In Android StoreTransaction is what's returned after a successful purchase. This class has a nullable orderId
  • In Android Transaction is the transactions in the CustomerInfo. This class has a non-nullable transactionIdentifier

The issue we are having is that in Flutter we only have one StoreTransaction with a non-nullable transactionId, and we are using it in both places, the PurchaseCompleted and CustomerInfo.

I see several ways of fixing this:

  • Making transactionIdentifier nullable. I don’t like this. It’s breaking
  • Making transactionIdentifier an empty string. Fixing it in next major
  • Making transactionIdentifier an empty string, deprecating it and creating orderId which is nullable and the same as transactionIdentifier. We’ll have nullable orderIds in the customer info transactions where this object is also used. In Android we have two classes, one for CustomerInfo transactions (Transaction with non-nullable transactionId ) and StoreTransaction which is used for completed purchases
  • Making a copy of StoreTransaction and name it CompletedPurchase , but with a nullable transactionIdentifier. Also breaking since we need to modify the PurchaseCompleted callback to receive this object. Making a new callback won’t work because the broken `PurchaseCompleted will keep crashing.

In this PR I am doing number 2, since it's the least breaking. This only affects apps using Amazon paywalls, which is not many.

Will fix #1049

@RevenueCat-Danger-Bot
Copy link

RevenueCat-Danger-Bot commented Apr 25, 2024

1 Message
📖 Size increase: 1.26 KB

Generated by 🚫 Danger

@Deprecated('Use orderId instead.')
/// RevenueCat Id associated to the transaction.
@Default('') String transactionIdentifier,
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be made optional in order to have a default, which it actually makes it a breaking change

@vegaro vegaro added the pr:fix A bug fix label Apr 26, 2024
@vegaro vegaro force-pushed the sdk-3430-crash-after-amazon-purchase-in-flutter branch from 1839bd1 to ec6b4f3 Compare April 26, 2024 15:08
@vegaro vegaro changed the title [WIP] Crash on Amazon paywalls after purchasing Crash on Amazon paywalls after purchasing Apr 26, 2024
@vegaro vegaro marked this pull request as ready for review April 26, 2024 15:12
@vegaro vegaro requested a review from a team April 26, 2024 15:14
@vegaro vegaro force-pushed the sdk-3430-crash-after-amazon-purchase-in-flutter branch from fe066d9 to aed64da Compare April 26, 2024 15:25
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this!

@vegaro vegaro merged commit d73f31b into main Apr 29, 2024
8 checks passed
@vegaro vegaro deleted the sdk-3430-crash-after-amazon-purchase-in-flutter branch April 29, 2024 17:11
This was referenced Apr 30, 2024
vegaro added a commit that referenced this pull request Apr 30, 2024
**This is an automatic release.**

### Bugfixes
* Crash on Amazon paywalls after purchasing (#1053) via Cesar de la Vega
(@vegaro)
### Dependency Updates
* BillingClient has been updated to version 6.2.1
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.6.1 (#1059) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.10.1](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.1)
* [Android
7.10.0](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.0)
* [iOS
4.41.2](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.2)
* [iOS
4.41.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.1)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.6.0 (#1056) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.10.1](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.1)
* [Android
7.10.0](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.0)
* [iOS
4.41.2](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.2)
* [iOS
4.41.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.1)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.5.1 (#1054) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.10.1](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.1)
* [Android
7.10.0](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.0)
* [iOS
4.41.2](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.2)
* [iOS
4.41.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.1)
### Other Changes
* Add `trigger_bump` lane (#1058) via Cesar de la Vega (@vegaro)

---------

Co-authored-by: Cesar de la Vega <[email protected]>
Jethro87 pushed a commit to Jethro87/purchases-flutter that referenced this pull request Jan 4, 2025
In `PurchaseCompleted` we are passing a Flutter's `StoreTransaction` in
the callback. This is very confusing but:

- In Android `StoreTransaction` is what's returned after a successful
purchase. This class has a nullable `orderId`
- In Android `Transaction` is the transactions in the CustomerInfo. This
class has a non-nullable `transactionIdentifier`

The issue we are having is that in Flutter we only have one
`StoreTransaction` with a non-nullable `transactionId`, and we are using
it in both places, the `PurchaseCompleted` and `CustomerInfo`.

I see several ways of fixing this:

- Making transactionIdentifier nullable. I don’t like this. It’s
breaking
- Making transactionIdentifier an empty string. Fixing it in next major
- Making transactionIdentifier an empty string, deprecating it and
creating orderId which is nullable and the same as
transactionIdentifier. We’ll have nullable orderIds in the customer info
transactions where this object is also used. In Android we have two
classes, one for CustomerInfo transactions (Transaction with
non-nullable transactionId ) and StoreTransaction which is used for
completed purchases
- Making a copy of StoreTransaction and name it CompletedPurchase , but
with a nullable transactionIdentifier. Also breaking since we need to
modify the PurchaseCompleted callback to receive this object. Making a
new callback won’t work because the broken `PurchaseCompleted will keep
crashing.

In this PR I am doing number 2, since it's the least breaking. This only
affects apps using Amazon paywalls, which is not many.

Will fix RevenueCat#1049
Jethro87 pushed a commit to Jethro87/purchases-flutter that referenced this pull request Jan 4, 2025
**This is an automatic release.**

### Bugfixes
* Crash on Amazon paywalls after purchasing (RevenueCat#1053) via Cesar de la Vega
(@vegaro)
### Dependency Updates
* BillingClient has been updated to version 6.2.1
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.6.1 (RevenueCat#1059) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.10.1](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.1)
* [Android
7.10.0](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.0)
* [iOS
4.41.2](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.2)
* [iOS
4.41.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.1)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.6.0 (RevenueCat#1056) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.10.1](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.1)
* [Android
7.10.0](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.0)
* [iOS
4.41.2](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.2)
* [iOS
4.41.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.1)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 10.5.1 (RevenueCat#1054) via
RevenueCat Git Bot (@RCGitBot)
* [Android
7.10.1](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.1)
* [Android
7.10.0](https://github.com/RevenueCat/purchases-android/releases/tag/7.10.0)
* [iOS
4.41.2](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.2)
* [iOS
4.41.1](https://github.com/RevenueCat/purchases-ios/releases/tag/4.41.1)
### Other Changes
* Add `trigger_bump` lane (RevenueCat#1058) via Cesar de la Vega (@vegaro)

---------

Co-authored-by: Cesar de la Vega <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Purchase doesn't work properly with Amazon's Live App Testing
3 participants