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

[Feature] Pass externalPaymentMethodType || paymentMethodType to ExternalPaymentMethodConfirmHandler + PaymentSheetResult #9208

Closed
azazellj opened this issue Sep 9, 2024 · 7 comments
Labels

Comments

@azazellj
Copy link

azazellj commented Sep 9, 2024

Is your feature request related to a problem? Please describe.

For external payment type integration I should pass data to BE to notify which payment type was used for the specific transaction. Also I need to apply analytics for payment type.

Describe the solution you'd like

ExternalPaymentMethodResultHandler.onExternalPaymentMethodResult(
   context = fragmentActivity,
   externalPaymentMethodResult = ExternalPaymentMethodResult.completed(paymentMethodType = "external_paypal"),
)

val paymentSheet = rememberPaymentSheet(
   externalPaymentMethodConfirmHandler = remember { viewModel.paymentMethodConfirmHandler },
   paymentResultCallback = { paymentSheetResult ->
      viewModel.handlePaymentSheetResult(paymentSheetResult)
                    
      if (paymentSheetResult is PaymentSheetResult.Completed) {
         val paymentType = paymentSheetResult.paymentMethod,
      }
   },
)

Describe alternatives you've considered

Additional context

  • I'm using multiple external payment types
@GIgako19929
Copy link

``

@jaynewstrom-stripe
Copy link
Collaborator

Hi @azazellj we do provide the type to the ExternalPaymentMethodConfirmHandler, and we can't add it to PaymentSheetResult because it's a breaking change.

You should be able to store it when you get it in ExternalPaymentMethodConfirmHandler and use it where you need it as part of PaymentSheetResult.

Please let me know if that solves your issue.

@azazellj
Copy link
Author

It might work for the ExternalPaymentMethodConfirmHandler, but how it should work for the regular payments?
Like, I want to know, was it google pay, credit card or other payment method.
It's good that we have results of the payment, but some logic might be applied for the specific payment methods.

@jaynewstrom-stripe
Copy link
Collaborator

@azazellj
Copy link
Author

So I need to do an extra API call to get some data, that is already present somewhere in SDK, but won't be passed as a PaymentSheetResult param?

@jaynewstrom-stripe
Copy link
Collaborator

We would like to provide the payment/setup intent as part of the success result, but we can't make that change without a major version release in the SDK. Beyond that, it's not quite so simple. There are cases where we don't have it, or it's not up to date.

Your best option is to make the extra API call to get the up to date payment intent for now.

@GIgako19929
Copy link

Close

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

No branches or pull requests

3 participants