#development
1 messages · Page 1 of 1 (latest)
hello! i don't understand the question - based on your previous thread - The Stripe PaymentSheet isn't opening. We pointed out that the error code you shared comes usually when the presentPaymentSheet is called before initPaymentSheet - have you tried adding logs to check if this is this case?
yes
initpayementsheet is inisialized before calling presentpayment sheet
{id: pi_3MirOGKo2grgSU3G1H7a4iuV, object: payment_intent, amount: 4000, amount_capturable: 0, amount_details: {tip: {}}, amount_received: 0, application: null, application_fee_amount: 120, automatic_payment_methods: null, canceled_at: null, cancellation_reason: null, capture_method: automatic, charges: {object: list, data: [], has_more: false, total_count: 0, url: /v1/charges?payment_intent=pi_3MirOGKo2grgSU3G1H7a4iuV}, client_secret: pi_3MirOGKo2grgSU3G1H7a4iuV_secret_2sonYAtQKZqoWWPojX7sOwZBN, confirmation_method: automatic, created: 1678160440, currency: aud, customer: cus_NTp2boB7aYotgR, description: null, invoice: null, last_payment_error: null, latest_charge: null, livemode: true, metadata: {}, next_action: null, on_behalf_of: null, payment_method: null, payment_method_options: {card: {installments: null, mandate_options: null, network: null, request_three_d_secure: automatic}}, payment_method_types: [card], processing: null, receipt_email: test@yopmail.com, review: null, setup_future_usage: null, shipping: null, source: null, statement_descriptor: null, statement_descriptor_suffix: null, status: requires_payment_method, transfer_data: {destination: acct_1LluMl4IlGGPnC5Q}, transfer_group: null}
this is the payment intent response
did you change your code since you last discussed it with us?
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
//client_secret
paymentIntentClientSecret: paymentIntentData!['client_secret'],
merchantDisplayName: UserDetails.userName == ''
? bookingUserName
: UserDetails.userName,
customerId: paymentIntentData!['customer'],
customerEphemeralKeySecret: paymentIntentData!['ephemeralKey'],
customFlow: true,
style: ThemeMode.light,
testEnv: true,
applePay: true,
googlePay: true),
);
await Stripe.instance.presentPaymentSheet();
await Stripe.instance.confirmPaymentSheetPayment();
and you're still receiving this error message right?
yes
Hi @fast steeple did you get any error after running initPaymentSheet ?
A similar issue was discussed here https://github.com/flutter-stripe/flutter_stripe/issues/742
Can you check if you are returning the ephemeralKey secret instead of the ephemeralKey ID ?
@worn ocean in paymentintent ?
i didn't get ephemeralKey secret and ephemeralKey id in payment intent
But you are passing one in your code customerEphemeralKeySecret: paymentIntentData!['ephemeralKey'],
Your backend need to call Stripe's API to create a ephemeralKey,
https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-add-server-endpoint you can refer this doc for more details
i was created by my self
If you are not using ephemeralKey, you can just remove customerEphemeralKeySecret from your code.
still didnt get the payment sheet
I'd suggest to double check and sure all the params that you pass to initPaymentSheet are valid before calling it.
yes i check 5 times
becuase if i didnt put apple pay true its totally working fine
and payment also got successfully done
Flutter SDK is not an official library from Stripe, you can reach out to the developer directly and create an issue in https://github.com/flutter-stripe/flutter_stripe/issues
Can you have any other solution