capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
MIT License
185 stars 75 forks source link

PaymentSheet crashes on Android #232

Closed anonimitoraf closed 1 year ago

anonimitoraf commented 1 year ago

Platform

Describe the bug I get this error when I attempt to present a PaymentSheet (and the app just crashes). Happy to share more info if needed.

2022-11-17 09:39:53.573 15361-15361/com.joinflux.flux E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.joinflux.flux, PID: 15361
    android.util.SuperNotCalledException: Activity {com.joinflux.flux/com.stripe.android.paymentsheet.PaymentSheetActivity} did not call through to super.onCreate()
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3661)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3813)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

JS code:

const createRes = await stripe.createPaymentSheet({
  paymentIntentClientSecret: clientSecret,
  customerEphemeralKeySecret: ephemeralKey,
  customerId: userId,
})
console.log({ createRes })
const paymentResult = await stripe.presentPaymentSheet()
console.log({ paymentResult })

Java code:

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      registerPlugin(com.getcapacitor.community.stripe.StripePlugin.class);
  }

  @Override
  public void onStart() {
    super.onStart();
  }
}
anonimitoraf commented 1 year ago

Setting merchantDisplayName in the call to stripe.createPaymentSheet works

(Source)