#pika-flutter-ios
1 messages ยท Page 1 of 1 (latest)
pika-flutter-ios
@deep hinge going to be tough to help as we don't own/maintain the Flutter library and I barely understand Mobile development myself.
What is common with iOS is not realizing you need to set the right returURL when you confirm the PaymentIntent.
so android is not mandatory, but ios its needed?
I think they have different fallback methods, but it's just an educated guess
Because the intent does return a 2200
200*
I understand Flutter is not owned, but would like some insight of IOS part
not sure what that could mean "returns a 200". An intent returns nothing
An API request returns something but then I need to understand exactly what you are doing.
I am trying to help, right now you didn't give much just yet ๐
there's no exact code, no clear understanding about which part is succeeding or failing after which line of code, which tutorial for Flutter you are following, etc.
So to my understanding, there are 3 steps in Stripe:
create payment intent
initialize payment method
display payment method
And during displaying payment method it doesnt show anything
Kind of. The first one is an API method server-side https://stripe.com/docs/api/payment_intents/create
the other two I don't really know what they mean, they must be some Flutter specific thing (which again we don't build)
For exact code this is it:
yes so server side works
I just want to know the possible causes of sheet not showing up
thats less Flutter related and more IOS related
which exact Flutter specific docs are you following?
flutter_stripe
that's just one word
Please share the exact URL of the exact end to end tutorial you are following
Also are you using Connect? I see stripeAccountId in one of your requests. Can you give an exact example PaymentIntent id pi_123 you are testing this with?
and what is access_token?
Yes I am using connect, the money goes directly to the franchisee
access_token is trivial, its what we use to verify on our own server
so has nothing to do with Stripe
gotcha. So can you try without Connect at all to start and see if that works?
let me try, though I wonder whether that makes the diff
I also assume that if an error happens something would be log to your console and you should be able to find out why it's being dismissed
Sure. Let's try to collect the information I asked for earlier and go step by step
we tried wih no connect account, wont work
Okay can you share an exact PaymentIntent id please and explain how you changed the code in your server-side and client-side app so that I can help?
One moment, we are trying out on our side
Do you know which fields are mandatory for IOS to initialize a payment method?
I do not know, I don't understand what "initialize a payment method" could mean
flutter: Response body: {"amount":420,"amount_capturable":0,"amount_details":{"tip":{}},"amount_received":0,"application":"ca_OqPW8ScQuHxfGiQ9PGpQ9yXi3yDcdUcl","application_fee_amount":null,"automatic_payment_methods":null,"canceled_at":null,"cancellation_reason":null,"capture_method":"automatic","client_secret":"pi_3O9zxUGbxsnujgpg1z47UREm_secret_i1QJEVGOSvNwrSZDBxrursl9y","confirmation_method":"automatic","created":1699404568,"currency":"eur","customer":null,"description":null,"id":"pi_3O9zxUGbxsnujgpg1z47UREm","invoice":null,"last_payment_error":null,"latest_charge":null,"livemode":true,"metadata":{},"next_action":null,"object":"payment_intent","on_behalf_of":null,"payment_method":null,"payment_method_configuration_details":null,"payment_method_options":{"ideal":{}},"payment_method_types":["ideal"],"processing":null,"receipt_email":null,"review":null,"setup_future_usage":null,"shipping":null,"source":null,"statement_descriptor":null,"statement_descriptor_suffix":null,"status":"requires_payment_method","tr
This is what it returns from the server
So at least we are sure that creating payment intent is correct
yeah that's just a raw PaymentIntent JSON
Yes that it is returned from the Stripe server
So according to the steps here:
STEP 2: Initialize Payment Sheet
From line 7โ15, in the makePayment function, we initialize a payment sheet. This will be used to create the payment sheet modal where we will fill in our card details and pay.
We pass in the client_secret obtained from the payment intent from the previous step. You have access to a range of parameters here including style which allows us to select the dark theme!
STEP 3: Display Payment Sheet
The final step is to display the modal sheet.
It has to be one of the two being wrong
This is from the url I sent you before
So that PaymentIntent you shared was still created on the connected account. I thought you were disabling Connect so taht we could narrow things down
it also has only iDEAL right now (which I assume is the return URL bug I mentioned)
no it is not, because we explicitely state ideal
Which is stated here in the code I provided:
- It is created on a connected account
- It only has iDEAL because you code only passes iDEAL
Since you are asking for help, I'm asking you to try and do this step by step
- Remove any Connect-specific code for now
- Use card not iDEAL
I know about 2, we are changing id for 1
Hi @deep hinge I'm taking over this thread
Hi there
Situation is as follows: Everything works perfectly for Android, but somehow at IOS it doesnt display the payment sheet.
We are currently testing out what your colleague proposes
Did you see any error after calling presentPaymentSheet ?
it didnt, but we have an assumption that it has to do with fields or variables we need to pass to IOS, but not needed in Android
like return url
so we are currently working on that one, will let you know whether that one works out
Ok
I think with return url we are able to pass to the next step
There may be an error on our side to make it entirely work, but apple pay is still not working
ideal is half ready (with something we need to do outside Stripe we think)
So we are 100% sure that we are calling the server of Stripe correctly, we also get the correct response back, for instance:
{'id': 'pi_3OA0VAGvLB0vMUvf19pt1HCe', 'object': 'payment_intent', 'amount': 50, 'amount_capturable': 0, 'amount_details': {'tip': {}}, 'amount_received': 0, 'application': None, 'application_fee_amount': None, 'automatic_payment_methods': None, 'canceled_at': None, 'cancellation_reason': None, 'capture_method': 'automatic', 'client_secret': 'pi_3OA0VAGvLBXXXXXX2', 'confirmation_method': 'automatic', 'created': 1699406656, 'currency': 'eur', 'customer': None, 'description': None, 'invoice': None, 'last_payment_error': None, 'latest_charge': None, 'livemode': True, 'metadata': {}, 'next_action': None, 'on_behalf_of': None, 'payment_method': None, 'payment_method_configuration_details': None, 'payment_method_options': {'card': {'installments': None, 'mandate_options': None, 'network': None, 'request_three_d_secure': 'automatic'}}, 'payment_method_types': ['card'], 'processing': None, 'receipt_email': None, 'review': None, 'setup_future_usage': None, 'shipping': None, 'source': None, 'statement_descriptor': None, 'statement_descriptor_suffix': None, 'status': 'requires_payment_method', 'transfer_data': None, 'transfer_group': None}
So the payment can be created correctly server side, but the next steps on client side is bugging out:
intialize the payment and display the payment
Our assumption is that initialize the payment goes wrong which causes the display payment part to not go off
Our payment initalization looks like this:
Future<void> _initializePaymentMethod(Map<String, dynamic> paymentIntent, String country, widget, String paymentOption) async {
if (Platform.isAndroid && paymentOption == 'GOOGLEPAY') {
var gpay = PaymentSheetGooglePay(
merchantCountryCode: country,
currencyCode: widget.restaurant.currency);
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret: paymentIntent['client_secret'],
style: ThemeMode.dark,
googlePay: gpay,
merchantDisplayName: widget.restaurant.franchise));
} else if (Platform.isIOS && paymentOption == 'APPLEPAY') {
var applePay = PaymentSheetApplePay(merchantCountryCode: country);
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret: paymentIntent['client_secret'],
style: ThemeMode.dark,
applePay: applePay,
merchantDisplayName: widget.restaurant.franchise));
}
else {
BillingDetails billingDetails = BillingDetails(
name: '${UserVariable.firstName} ${UserVariable.lastName}',
);
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret: paymentIntent['client_secret'],
billingDetails: billingDetails,
style: ThemeMode.dark,
merchantDisplayName: widget.restaurant.franchise));
}
}
https://stripe.com/docs/apple-pay?platform=react-native#accept apple pay has some pre-requisites, you should follow these steps to enable apple pay in your app.
Gotcha, we had done some certification before with another payment provider. Does it mean we need to reconfigure some parts with Stripe to make it work?