#carasco6170_api
1 messages ¡ Page 1 of 1 (latest)
đ 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.
I have setup also like:
<form onSubmit={handleSubmit}>
<PaymentElement />
<StyledSubmit type="submit">Subscribe</StyledSubmit>
</form>
i am getting error like: Element, which cannot be used to create card PaymentMethods.
Could you please share more details about the error? a complete stacktrace ? or an API request Id please
https://support.stripe.com/questions/finding-the-id-for-an-api-request?
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
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?
yes
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,
};
Then you should follow this section of the official Subscription integration:
https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements#collect-payment
And use confirmPayment in order to confirm the payment_intent created from the Subscription:
https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements#complete-payment
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
Can you share the PaymentIntent Id ?
You're likely configuring them in the wrong PM settings
Subscriptions use the PM config set here: https://dashboard.stripe.com/settings/billing/invoice
I only left the card but i see also others
Please share the pi_xxx ID then
"pi_3PRXoUIyDClzFDYg0NLJpDTx_secret_MnFHU64NA41HvXZKGYVrcQULv"
Checking
Could it be that this intent was generated before you made the changes to disable SEPA etc?
no i mean
i did it once again
like now and same case
i dont have it even activated
Still checking, please be patient
Can you create a new Subscription (like this: https://dashboard.stripe.com/test/logs/req_7dTvcu5Tt0Pv3X) and share the ID here please?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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
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
clientSecret
:
"pi_3PRYAdIyDClzFDYg2OMe92kB_secret_ptzbjfpz2n2w5aIHrjbCWjMyd"
subscriptionId
:
"sub_1PRYAdIyDClzFDYgiDOU6bvq"
Also, please share the code you're using to initialise the Payment Element
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>
Thanks, checking on this
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
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
In the meantime, you can use this parameter to specifically set the PMs you want supported on the sub/invoices: https://docs.stripe.com/api/subscriptions/create#create_subscription-payment_settings-payment_method_types
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.