#carasco6170_api

1 messages ¡ Page 1 of 1 (latest)

silk oakBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1251115676131922001

📝 Have more to share? Add details, code, screenshots, videos, etc. below.

distant otter
#

I have setup also like:

<form onSubmit={handleSubmit}>
<PaymentElement />
<StyledSubmit type="submit">Subscribe</StyledSubmit>
</form>

whole nymph
distant otter
#

I have it on client side:

IntegrationError: Invalid value for createPaymentMethod: card was payment Element, which cannot be used to create card PaymentMethods.

, T = new s.No("Invalid value for ".concat(I, ": ").concat(N, " was ").concat(A, " Element, which cannot be used to create ").concat(w, " PaymentMethods."));
return (0,
u.zS)(T)

#

There is no logs for this

whole nymph
#

Ok I see, thanks for the additional details.
Let's digg into this together... why are you using createPaymentMethod ?

#

what guide are you following exactly and what you want to achieve from using Stripe Element?

distant otter
# whole nymph Ok I see, thanks for the additional details. Let's digg into this together... wh...

i saw it somewhere to get a payment id and pass it to the backend and do sth like this:

const customer = await stripe.customers.create({
email: createPaymentDTO.email,
payment_method: createPaymentDTO.paymentMethodId,
invoice_settings: {
default_payment_method: createPaymentDTO.paymentMethodId,
},
});

  const subscription = await stripe.subscriptions.create({
    customer: customer.id,
    items: [{ price: createPaymentDTO.priceId }],
    expand: ['latest_invoice.payment_intent'],
  });

  return {
    clientSecret: subscription.latest_invoice.payment_intent.client_secret,
  };
whole nymph
silk oakBOT
distant otter
#

Ok, but I also have paypal link and sepa options and I want to hide them. I turned it off in the settings, but it still appears

whole nymph
#

Can you share the PaymentIntent Id ?

keen pilot
#

You're likely configuring them in the wrong PM settings

distant otter
#

I only left the card but i see also others

silk oakBOT
keen pilot
#

Please share the pi_xxx ID then

distant otter
#

"pi_3PRXoUIyDClzFDYg0NLJpDTx_secret_MnFHU64NA41HvXZKGYVrcQULv"

keen pilot
#

Checking

#

Could it be that this intent was generated before you made the changes to disable SEPA etc?

distant otter
#

no i mean

#

i did it once again

#

like now and same case

#

i dont have it even activated

keen pilot
#

Still checking, please be patient

distant otter
#

i am doing it like that:

const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [
{
price: createPaymentDTO.priceId,
},
],
payment_behavior: 'default_incomplete',
payment_settings: { save_default_payment_method: 'on_subscription' },
expand: ['latest_invoice.payment_intent'],
});

but i am using test credentials if it means sth

keen pilot
#

Yes, but can you send a new request using those parameters and share the resulting sub_xxx ID

#

I want to see that it reflects the PM settings on your account. The intent I'm looking at is over an hour old at this point

distant otter
#

clientSecret
:
"pi_3PRYAdIyDClzFDYg2OMe92kB_secret_ptzbjfpz2n2w5aIHrjbCWjMyd"
subscriptionId
:
"sub_1PRYAdIyDClzFDYgiDOU6bvq"

keen pilot
#

Also, please share the code you're using to initialise the Payment Element

distant otter
#

const createPaymentMutation = useMutation({
mutationFn: (payload) => createStrpiePayment(payload),
onSuccess: ({ data }) => {
console.log(data);
setClientSecret(() => data.clientSecret);
},
});

const options = {
clientSecret: clientSecret,
locale: lang,
appearance: {
theme: 'flat',
variables: {
borderRadius: '10px',
},
rules: {
'.Input': {
borderRadius: '10px',
},
},
},
};

useEffect(() => {
const payload = {
email: 'example@gmail.com',
priceId: priceId,
};

createPaymentMutation.mutate(payload);

}, []);

if (!clientSecret) {
return <Loading />;
}

return (
<>
{/* <OneTimePaymentView /> */}
<Elements stripe={stripePromise} options={options}>
<StrpiePaymentView />
</Elements>
</>
);

#

<form onSubmit={handleSubmit}>
<PaymentElement />
<StyledSubmit type="submit">Subscribe</StyledSubmit>
</form>

keen pilot
#

Thanks, checking on this

keen pilot
#

Can we ask you to write in to our team? https://support.stripe.com/contact/email?topic=api_integration

We need to spend some more time investigating this. Seems like your test payments are using payment method settings that are inaccessible in the Dashboard