#ptman-upe-holds
1 messages ยท Page 1 of 1 (latest)
HI ๐ yes, you can use the new Payment Element in place of the previous Card Element, are you encountering trouble when trying to do so?
Our documentation on how to create and handle a hold are here:
https://stripe.com/docs/payments/place-a-hold-on-a-payment-method
ptman-upe-holds
that just mentions the card element
I'd hope for something that shows createPaymentMethod using the payment element
Can you help me understand what you're referring to? The document that I linked does not talk about any Stripe Elements.
it links to https://stripe.com/docs/payments/accept-a-payment-synchronously#web-collect-card-details
Oh, sorry, I didn't realize you hadn't found our guide on how to use the Payment Element, you can see it here:
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
If I'm making a hold, I need to create a payment method
createPaymentMethod() wants card, the card element, not payment, the payment element
Correct, createPaymentMethod does not support the Payment Element, because it is an older method that is typically not needed anymore.
The field that instructs us to only authorize the payment (not fully process it) is on the Payment Intent object, not on the Payment Method object, so you don't need to have already created a Payment Method. You'll notice in the first code snippet, in the guide on holds, that no Payment Method is provided while creating the Payment Intent:
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
I'm creating holds, not accepting payments directly
https://stripe.com/docs/payments/place-a-hold-on-a-payment-method says "Before continuing to capture, attach a payment method with card details to the PaymentIntent, and authorize the card by confirming the PaymentIntent. You can do this by setting the payment_method and confirm fields on the PaymentIntent."
with a link to https://stripe.com/docs/payments/accept-a-payment-synchronously#web-collect-card-details, which mentions stripe.createPaymentMethod
Are you going to process the payment eventually, or are you just creating holds?
I'm going to process it once service has been rendered
Creating a Payment Method via the Payment Element requires use of a Setup Intent, which seems unnecessary for your flow.
I think the most straight-forward approach is for you to follow the Payment Element guide, but set capture_method to manual when creating the Payment Intent. Once the Payment Intent goes to the requires_capture state and you're ready to capture it, then use this function make the request to capture it:
https://stripe.com/docs/api/payment_intents/capture
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
right
I know how to capture
I want to move the payment intent from requires_payment_method to requires_capture
using the payment element style
That's the confirmation step, you would use confirmPayment
instead of the older card element style, which we're trying to move away from
That is covered in Step 5 of our guide on how to use the Payment Element:
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&client=html#web-submit-payment
so the correct paymentIntent is used based on clientSecret instead of separately attaching a payment method using createPaymentMethod?
Are you using already created Payment Methods, or are you wanting to create a Payment Method as part of the flow?
The Payment Element creates a Payment Method, from the information that your customer has entered into it, and attaches it to the related Payment Intent as part of the confirmPayment step.
thank you
now I can indeed do the simple hold-confirm-capture using the payment element
I wonder why the code was so convoluted using the card element
maybe it will get there as I re-add handling of saved card and connected account
All of those topics do add some complexity, so it's very likely your code will need to grow as you incorporate them.
if I use setup_future_use with connect, does it get stored to the main account or the connected account?
it's also been a couple of years since I worked with this, and stripe has just worked so that I haven't needed to touch it
Ah gotcha, things have a changed a fair bit just this year, so I suspect you'll see some pretty drastic changes if you haven't touched it for several years.
Where the objects get created is dependent on the charge structure that you're using. If you're using Destination Charges (setting transfer_data.destination) then the objects will all be created on your Platform account. If you're using Direct Charges (using the Stripe-Account header/param), then all of the objects will be stored on the Connected Account.
direct charges
and we did manage to store the payment details on the platform account previously, but it took some work
Hello ๐
Taking over as toby needs to step away soon
direct charges
Gotcha. So in that case the PaymentMethod would be stored on the connected account.
and in order to store the payment method on the platform I need to do that first and then clone the paymentmethod to the connected account and and then create the paymentintent
or so I think it was done
Yup exactly.