I'm trying to update a credit-card
using the StripeCheckout
, I saw that another user has asked a similar thing here.
The problem's that I'm not able to replicate the session object without passing any amount, I did:
const domainURL = process.env.APP_DOMAIN;
let opts = {
payment_method_types: ["card"],
mode: 'setup',
success_url: `${domainURL}/pay/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${domainURL}/pay/cancel`
};
// Make session
let session = await stripe.checkout.sessions.create(opts);
let url = `${domainURL}/pay/checkout-session?sessionId=${session.id}`;
return url;
the code above generate the url for Stripe
session, and the following window is opened:
so this seems to works apparently, but when I save the card clicking on "Salva carta" I get:
UnhandledPromiseRejectionWarning: Error: Stripe: Argument "id" must be a string, but got: null (on API request to
GET /customers/{id}
)
I also tried:
let opts = {
payment_method_types: ["card"],
mode: 'setup',
setup_intent_data: {
metadata: {
'customer_id': 'customer id',
}
},
success_url: `${domainURL}/pay/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${domainURL}/pay/cancel`
};
as described here
but same problem
from Cannot update credit card using session
No comments:
Post a Comment