#marroco0488_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!
🔗 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/1212437259593195563
📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!
Hi 👋 if you're using the Card Element you want to use confirmCardPayment instead.
https://docs.stripe.com/js/payment_intents/confirm_card_payment
mmm I see, in the documenation was like this -> const {error} = await stripe.confirmPayment({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: "https://example.com/order/123/complete",
}
});... or im reading the wrong documentation?
That's for the Payment Element, rather than the Card Element.
can you please describe me how I build the subscription; I use this guide -> https://docs.stripe.com/billing/subscriptions/build-subscriptions?ui=elements
That guide walks through the complete process, but it also uses the Payment Element, below is a snippet from Step 5 showing that:
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');```
but in your message you mentioned you're using the Card Element:
> having problems with the card element for subscription
You will either need to use the Payment Element as the guide suggests, or continue using the Card Element and use `confirmCardPayment` instead of `confirmPayment`.
I got this error -> Uncaught IntegrationError: Invalid value for confirmCardPayment: payment_method.card was payment Element, which cannot be used to create card PaymentMethods.
Hello! I'm taking over and catching up...
thanks
It looks like you're mixing approaches. You can use the Card Element, or you can use the Payment Element. You can't use both. Which do you want to use?
im not sure of the difference, sorry. What im trying to do is to confirm the payment... in my backend i already create the client secret with a payment intent, I send the client secret to my front where you can see the logic is creating the card, but them im stuck
Payment Element is recommended. If you want to use that you need to switch from confirmCardPayment to confirmPayment: https://docs.stripe.com/js/payment_intents/confirm_payment
but know i reciebe this -> Uncaught (in promise) IntegrationError: stripe.confirmPayment(): expected either elements or clientSecret, but got neither.
that was the first error that i report in this channel
Can you share the code that's throwing that error?
sure
if I do a console.log of elements i got this -> Proxy(t) {_emit: ƒ, _once: ƒ, _removeAllListeners: ƒ, _on: ƒ, _validateUserOn: ƒ, …}
[[Handler]]
:
Object
deleteProperty
:
ƒ deleteProperty(target, key)
get
:
ƒ get3(target, key, receiver)
has
:
ƒ has(target, key)
ownKeys
:
ƒ ownKeys(target)
set
:
ƒ set3(target, key, value, receiver)
[[Prototype]]
:
Object
[[Target]]
:
t
[[IsRevoked]]
:
false
I see I thought with this -> const element=this.elements;
i can just pass element but seems that needs to be elements with this specific name
its working now
Glad to hear it's working!