#kekko7072

1 messages · Page 1 of 1 (latest)

daring wingBOT
river gazelle
#

Can you elaborate a bit more? What's the issue?

outer wing
#

Hy i have a backend code where i save for future usage the payment method. This is the code i use

#

stripe.checkout.sessions.create({
mode: "payment",
payment_method_types: ["card"],
customer: customerId,
// https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#save-payment-method-details
payment_intent_data: {setup_future_usage: "off_session"},
currency: "eur",
line_items: [
{
price_data: {
currency: "eur",
product_data: {
name: "Powerbank",
},
unit_amount: req.priceAmount,
},
quantity: 1,
},
],
success_url:
process.env.API_ENV === "dev" ?
${amperryGoDomainDev}/success :
${amperryGoDomainProd}/success,
cancel_url:
process.env.API_ENV === "dev" ?
${amperryGoDomainDev}/cancel :
${amperryGoDomainProd}/cancel,
metadata: {
uid: uid,
stationId: stationId,
orderId: orderId,
},
});

Securely accept payments online.

#

but now i'm facing often this issue you can find: req_WZHY5cvmXinFZp

river gazelle
#

Error message is:

message: "You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method."

#

Are you trying to use Checkout to accept payments?

outer wing
#

yes i'm using that on web

#

but i configured that payment_method should be saved

#

but sometimes is not saved.

#

for example in this payment intent why it's not added for future usage?

river gazelle
#

So, you don't need to create Payment Intents if you're using Checkout.

outer wing
#

pi_3MlnNxA94JJJ3znb0uAp3xMg

#

sorry my mistake i'm referring to payment intent

#

called from my app

#

this is the backend of this call

#

import * as functions from "firebase-functions";
import {error, stripe} from "../constants";

export const Payment = functions
.region("europe-west3")
.https.onCall(async (req, context) => {
try {
const ephemeralKey = await stripe.ephemeralKeys.create(
{customer: req.customer},
{apiVersion: "2020-08-27"}
);
const hold: boolean = req.use_hold ?? false;

  // API DOC https://stripe.com/docs/api/payment_intents/create
  const paymentIntent = await stripe.paymentIntents.create({
    amount: req.amount,
    currency: req.currency,
    customer: req.customer,
    setup_future_usage: "off_session",
    capture_method: hold ? "manual" : "automatic", // https://stripe.com/docs/payments/place-a-hold-on-a-payment-method
  });

  return {
    paymentIntent: paymentIntent.client_secret,
    ephemeralKey: ephemeralKey.secret,
    customer: req.customer,
  };
} catch (e) {
  error(e);
  return {
    paymentIntent: "",
    ephemeralKey: "",
    customer: req.customer,
  };
}

});

Separate payment authorization and capture to create a charge now, but capture funds later.

#

but the result is this: pi_3MlnNxA94JJJ3znb0uAp3xMg

river gazelle
#

It looks like the Customer ID you're passing doesn't have any attached Payment Methods. How are you creating Payment Methods right now? Is that what the Checkout Session code you posted above is for?

outer wing
#

Yes

#

When they do the payment intent I save their payment info

#

But in this user seems it didn’t work

#

So I save the payment method on this way

river gazelle
#

Hmmm, can you describe a step-by-step explanation of what you want the payment flow to look like?

outer wing
#

So I have two types of payment experience one in the web of the day is used to rent the service without the app and another one which is from the app

#

For the webapp i use the check out and user can pay directly and Then I save the metodo On their Stripe account, so when they are you, we’ll try next time the service they will have the payment ready. In the app are use payment intends to configure the payment with the Apple Pay and Google pay but also with the credit card so user can also configure the payment Samantha and then once it’s configured they can pay with The payment method already registered

river gazelle
#

That's really difficult to understand. I would recommend looking into Checkout in setup mode. This will allow you to save payment methods for future usage, which will give you the option of creating Payment Intents without bringing your customer back into the payment flow: https://stripe.com/docs/payments/save-and-reuse?platform=checkout

Use a supported platform to save card details and charge your customers later.

outer wing
#

The problem is that it seems like the payment intent for the registration of the car. Sometimes it’s not working for some users. Please note the user I sent you before which paid, but didn’t have Ia card registered

#

Okay, but can I do Payment intent without check out ?

river gazelle
outer wing
#

Ok clear I will review the flow

#

Last thing

#

I’m getting an issue with payment setup confirm

#

“You can not confirm this payment intent because it’s already succeeded after being previously confirmed”

#

What does it mean on the specific ? The charge has already been done?

river gazelle
outer wing
#

This issue is due the fact that the checkout code it’s called automatically and j think it called before updating on the server the customer status from “need to pay” to “payed”

river gazelle
#

That means an authorization has been successful and the Payment Intent is ready to be paid

#

yeah, it will also error in that way if the Payment Intent is paid

outer wing
#

Oak

#

Can you send me links of how to implement the flow correctly because I think I will need to redo the configuration and payment and so I want to read docs to do it the right way

river gazelle
#

Not sure if that's the flow you want. It's difficult to tell what you payment flow is supposed to look like. Right now it's a bit all over the place

outer wing
#

Ok thank you