#kekko7072
1 messages · Page 1 of 1 (latest)
This is my code to create user with card
Are you using the Flutter lib?
yes
exports.call = functions
.region("europe-west3")
.https.onCall(async (req, context) => {
const {
customerId = req.createNewCustomer,
email = req.email,
name = req.fullName,
phoneNumber = req.phoneNumber,
payment_method_types = ["card"],
}: {
customerId: string;
email: string;
name: string;
phoneNumber: string;
payment_method_types: string[];
} = req;
const customer =
customerId == "false"
? await stripe.customers.create({
email: email,
description: context.auth?.uid,
name: name,
phone: phoneNumber,
})
: await stripe.customers.retrieve(customerId);
const setupIntent = await stripe.setupIntents.create({
customer: customer.id,
payment_method_types,
usage: "off_session",
/*confirm: true,
return_url: "app.amperry",*/
});
});
this is the issue i created:
Well, that library isn't official (it's third-party)
How are you initialising the Payment Sheet
i'm using the stock system
Is Apple Pay setup on your domains/devices? Do you meet the requirements?
my problem is that i want to do it using the api of the backend and the api on flutter without oaymentSheet
because i dont want to make user pay for configuration
yes i'm already using flutter
and google pay and apple pay
with all the files configured
That doesn't answer the question:
- Have you registered your app for an Apple Pay domain certificate? Steps here: https://stripe.com/docs/apple-pay?platform=ios#accept
- Do you have a real card in your device wallet?
I don't understand what you mean here. Do what on the backend?
At the moment i use payment sheet to register apple pay and google pay and save the information as payment method for future usage
but to use this logic i need to do a payment of at least 0,5 €
so my idea is to register apple pay and google pay as i do with card to use it with future usage
but without payment sheet
because i dont want to hold 0,5 € from user during configuration
That shouldn't be true if you use a Setup Intent, which also supports the Payment Sheet and allows your to save Apple Pay payment methods
const paymentIntent = await stripe.paymentIntents.create({
amount: req.amount,
currency: req.currency,
customer: req.customer,
//off_session: true,
setup_future_usage: "off_session",
capture_method: hold ? "manual" : "automatic", //https://stripe.com/docs/payments/place-a-hold-on-a-payment-method
});
this is my payment intent code that i call from payment sheet
you are saying that i can call this with amount 0?
Why are you using Payment Intents if you're only saving the payment details and there's no payment?
I'm confused. Can we take a step back – you want to save payment details, from wallets like Apple Pay, for future payments. Correct?
yes
at the moment i can register card calling from my app this:await stripe.setupIntents.create({
customer: customer.id,
payment_method_types,
usage: "off_session",
/confirm: true,
return_url: "app.amperry",/
});
Then you should be creating a Setup Intent, not a Payment Intent: https://stripe.com/docs/payments/save-and-reuse
Ok, and why doesn't this work with Apple Pay in the Payment Sheet? It should
no it's not clear to me
this is the flow for card
how can i create setupIntent with wallet payment ?
Wallet PMs fall under the card payment method type
so i need to pass the token of apple pay?
No, Apple Pay should be surfaced on the Payment Sheet automatically for the Setup Intent assuming your device fulfils the Apple Pay requirements
ok
so i can call payment Sheet with setup intent?
this is my flutter code with payment sheet
the flow will be:
- I call setup intent with payment shet
- i retreve from backend the payment sheet ephemeral key and setup intent code
- i register the wallet pay
Hi! I'm taking over this thread.
can you read previous message?
Yes that looks correct:
- Create a SetupIntent & ephemeral key on the backend
- Get the client_secret & ephemeral key on the frontend
- And launch the PaymentSheet
ok
very clear
so as amount i will pass 0 in payment sheet?
can you leave the treat open for 24 hr so i can test?
I'm not familiar with flutter-stripe (this is not an official Stripe library), but with a SetupIntent there should be no amount (so maybe 0 if you need to set it).
i'm sorry for my poor explanation so i will test what you said
can you leave the treat open for 24 hr so i can test?
We automatically close threads after they become inactive. But feel free to reopen a new thread if needed later!