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

Update PaymentProvider.swift #83

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

zy19890102
Copy link
Contributor

sk1 purchase failed, but return success

zhangyu added 2 commits September 29, 2024 14:00
sk1 purchase failed, but return success
update change log
@@ -125,12 +125,20 @@ extension PaymentProvider: SKPaymentTransactionObserver {
forKey: transaction.payment.productIdentifier
), !handlers.isEmpty {
self.dispatchQueueFactory.main().async {
handlers.forEach { $0(queue, .success(transaction)) }
if let error = transaction.error {
Copy link
Member

Choose a reason for hiding this comment

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

This is only true if the transaction state is set to .failed. A user can manually check the error and transactionState properties of PaymentTransaction, which should have these values.

I'm not sure we need to throw an error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sometimes it is necessary to collect error information to improve the payment experience.

Copy link
Member

Choose a reason for hiding this comment

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

@zy19890102, why can't you collect the error information using PaymentTransaction? Could you please provide a minimal example where these changes are necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When users cancel payments, we will ask them for the reason behind the cancellation, whether it is due to the pricing of the product being too high or the subscription service not meeting their needs, in order to adjust our pricing strategy and subscription benefits.

Copy link
Member

Choose a reason for hiding this comment

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

@zy19890102 I see, thank you. But I don't get why you can't use the error property from the transaction.

There is a merge conflict. Please rebase, and could you also run the make fmt command in your terminal to format the codebase according to the project’s code style?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants