Skip to content

Payment Sheet fails to open with Direct Charges (stripeAccount) in v7.2.0 #447

Description

@PaulliDev

Platform

  • Web
  • iOS
  • Android (untested)

Describe the bug
Payment Sheet fails to open (immediate “There was an unexpected error — try again in a few seconds”) when the PaymentIntent is created as a Direct Charge (using stripeAccount to act in a connected account).
If I switch to Destination Charge (no stripeAccount, use transfer_data.destination, and a platform Customer), Payment Sheet works fine. This suggests the plugin doesn’t handle PIs/EKs created in a connected account context.

To Reproduce

  1. Create a connected account with card_payments + transfers active.
  2. Create a Customer inside the connected account and store its id (one per buyer×merchant).
  3. Server: create a PaymentIntent in the connected context (Direct Charge), and an Ephemeral Key for the same connected Customer and account:
// Server (Node, stripe-node)
const paymentIntent = await stripe.paymentIntents.create(
  {
    amount: 10000,
    currency: 'eur',
    customer: connectedCustomerId,                // cus_... in connected acct
    automatic_payment_methods: { enabled: true }, // also repros if ['card']
    description: 'Test direct charge'
  },
  { stripeAccount: merchantAccountId }            // <-- connected account context
);

const ephemeralKey = await stripe.ephemeralKeys.create(
  { customer: connectedCustomerId }
  {
    stripeAccount: merchantAccountId, // <-- connected account context again
    apiVersion: '2023-10-16' // mobile SDK API version
  }
);

// Then in App:
await Stripe.createPaymentSheet({
  merchantDisplayName: 'Test',
  customerId: connectedCustomerId,
  customerEphemeralKeySecret: ephemeralKey.secret,
  paymentIntentClientSecret: paymentIntent.client_secret,
  enableApplePay: false,
  enableGooglePay: false
});

await Stripe.presentPaymentSheet(); // => immediately fails with generic error

Now if you swap to Destination Charge for the same flow (no stripeAccount; use platform Customer, add transfer_data.destination and optional application_fee_amount). Payment Sheet opens and works.

Expected behavior
Payment Sheet should open and allow entering a card for a brand-new connected Customer, the same way it does in the Destination Charge flow. At minimum if Direct Charges aren’t supported the plugin should surface a clear error.

Screenshots
N/A (Payment Sheet crashes immediately and in console we're left with “unexpected error” toast).

Error in the console doesnt give any information (the log itself comes from paymentSheetFailed event listener):
Image

The most it does it points to this line in user-script:2
Image

Additional context
Testing on Real iPhone 14 Pro (ios 18.1.1) and on iPhone 15 Pro (ios 17.4) in Simulator, both with the same results.
Im using the newest version of the package 7.2.0.

Usage Product
In development.

Product Name:
Product URL :
Using Function:

  • Payment Sheet / Payment Flow
  • Apple Pay
  • Google Pay
  • Identity (@capacitor-community/stripe-identity)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions