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

Terminal package missing 'confirmPaymentIntent' method to process payment #341

Closed
2 of 3 tasks
yllaw opened this issue Mar 13, 2024 · 2 comments
Closed
2 of 3 tasks

Comments

@yllaw
Copy link
Contributor

yllaw commented Mar 13, 2024

Platform

  • Web
  • iOS
  • Android

Describe the bug

After collecting the payment intent via StripeTerminal, the next step is to confirmPaymentIntent.

Without this step the Stripe paymentIntent state cannot be changed to succeeded or requires_capture

This method is missing from the plugin

Expected behavior
A simple example could look like this in swift:

// StripeTerminal.swift

    public func confirmPaymentIntent(_ paymentIntent: PaymentIntent, call: CAPPluginCall) {
        Terminal.shared.confirmPaymentIntent(paymentIntent) { confirmResult, confirmError in
               if let error = confirmError {
                   print("confirmPaymentIntent failed: \(error)")
                   self.plugin?.notifyListeners(TerminalEvents.Failed.rawValue, data: [:])
                   call.reject(error.localizedDescription)
               } else if let confirmedIntent = confirmResult {
                   print("PaymentIntent confirmed: \(confirmedIntent)")
                   self.plugin?.notifyListeners(TerminalEvents.Completed.rawValue, data: [:])
                   call.resolve()
               }
           }
    }

And perhaps in the capacitor app the code to collect and process payment looks like this:

// Collect payment intent
await StripeTerminal.collect({ paymentIntent: "**************" });

// Process payment intent 
await StripeTerminel.confirmPaymentIntent();

More info on processing the payment intent can be found here

@yllaw
Copy link
Contributor Author

yllaw commented Mar 13, 2024

I have added a PR #342 for this

@rdlabo
Copy link
Member

rdlabo commented Mar 19, 2024

merged, and released @capacitor-community/stripe-terminal@5.5.0-beta.0

@yllaw yllaw closed this as completed Mar 19, 2024
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

No branches or pull requests

2 participants