#diarra
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
What platform are you using? iOS/Android/React Native?
I use an android emulator to launch my project, my language is flutter
You can collect billing details, for example: https://stripe.com/docs/payments/accept-a-payment?platform=android&ui=payment-sheet#billing-details-collection
I use this function to have my interface preconfigured from stripe: Future<void> makePayment() async {
try {
paymentIntent = await createPaymentIntent('100', 'USD'); //STEP 2: Initialize Payment Sheet
await Stripe.instance
.initPaymentSheet( paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret:paymentIntent!['client_secret'], //Gotten from payment intent
style: ThemeMode.dark,
merchantDisplayName: 'My shopper',
))
.then((value) {}); //STEP 3: Display Payment sheet
displayPaymentSheet();
} catch (err) {
throwException(err);
}
}
What fields do you want to collect?
just a field to have the name of the cardholder
It will be collected by default for card.
good, and how?? is there the possibility after payment to see the name of the cardholder somewhere??? kind is it collected or this name??
It should be available on the Charge object.
Could you please try and send an example PaymentIntent ID or Charge ID?
you are talking about payment method id
????
hummm I have this in my code source : createPaymentIntent(String amount, String currency) async {
try {
//Request body
Map<String, dynamic> body = {
'amount': calculateAmount(amount),
'currency': currency,
};
//Make post request to Stripe
var response = await http.post(
Uri.parse('https://api.stripe.com/v1/payment_intents'),
headers: {
'Authorization': 'Bearer ${dotenv.env['STRIPE_SECRET']}',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: body,
);
return json.decode(response.body);
} catch (err) {
throw Exception(err.toString());
}
}
Yes, can you run this and try to pay? (in Test mode)
yes
I made 7 payments in test mode, and in my dashboard at the payment level I see the payments made
Could you please share the PaymentIntent ID pi_xxx?
pi_3NDTRfIGy3YRUrDX1p1P4Vck
Okay, I checked and you can use billingDetailsCollectionConfiguration: {name: "always"} when configuring the PaymentSheet
i.e in this function Future<void> makePayment() async {
try {
paymentIntent = await createPaymentIntent('100', 'USD'); //STEP 2: Initialize Payment Sheet
await Stripe.instance
.initPaymentSheet( paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret:paymentIntent!['client_secret'], //Gotten from payment intent
style: ThemeMode.dark,
merchantDisplayName: 'My shopper',
))
.then((value) {}); //STEP 3: Display Payment sheet
displayPaymentSheet();
} catch (err) {
throwException(err);
}
}
Yes
and name: "always" is just a word by chance ??? can i change that??
You can set it to "automatic", "never" and "always"
https://stripe.dev/stripe-react-native/api-reference/modules/PaymentSheet.html#SetupParams
https://stripe.dev/stripe-react-native/api-reference/modules/PaymentSheet.html#BillingDetailsCollectionConfiguration
https://stripe.dev/stripe-react-native/api-reference/enums/PaymentSheet.CollectionMode.html
I have this paremeter billingDetails instead of billingDetailsCollectionConfiguration in the class SetupPaymentSheetParameters
in my code
What version are you using?
stripe version ??
flutter_stripe
flutter_stripe: ^4.0.0
Actually, it's not officially supported by Stripe, so it's best to ask the developers of the library: https://github.com/flutter-stripe/flutter_stripe
I see v8.0.0 is released so you might want to update
so with the flutter_stripe version: ^4.0.0 I can't have the functionality
Hi there 👋 jumping in as my teammate needed to step away. Since the flutter_stripe package is not one of our official packages, we aren't familiar with the functionality available in its different versions. As my teammate suggsted, reaching out to the owners/maintainers of that package is likely the best approach to get assistance with using it.