#pocketcolin
1 messages · Page 1 of 1 (latest)
Hello, looking in to this, and just to confirm, you are creating the Invoice and then calling this on the client secret from the Invoice's PaymentIntent?
elements,
confirmParams: {
// Make sure to change this to your payment completion page
return_url: "http://localhost:4242/checkout.html",
receipt_email: emailAddress,
},
});```
elements,
clientSecret: clientSecret,
confirmParams: {
return_url: `${window.location.href}`,
},
redirect: 'if_required',
})```
yep
at least pretty close
when I add the element to the page, I am setting mode: "subscription" . Would that cause an issue since this isn't a subscription purchase?
Interesting... if I change the mode to payment I get the following error instead:
so it seems like I need to set automatic_payment_methods: true but again not sure how to do that when creating an invoice.
Is there a specifc file that you got from the custom payment flow where it said to specify mode: 'subscription? As far as I know that is a setting is for a different flow than the one that you linked to
Are you setting this but otherwise doing the flow from the guide? https://stripe.com/docs/js/elements_object/create_without_intent
yeah no you can ignore that. The current integration was for a subscription purchase and I'm reusing the same elements. I can change the mode to whatever we want.
creating the element:
const elements = stripe.elements({
mode: 'payment',
amount: planAmount,
currency: 'usd',
appearance,
})
I more mean I think that may be the problem unless you are using that other flow https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
If you aren't using that flow, I don't think you need to do those settings at all
you mean the mode, amount, currency settings when initializing the element?
Reading through this guide: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment
It still says to create a PaymentIntent directly, but the problem with that is I'd like to attach an actual item with a specific Price ID to the purchase.
Yes, that is only needed for the other flow, if you are initializing the element with the intent from the invoice, you do not need to make thse settings
ohhh
well wait I am not initializing the element with the intent from the invoice. I'm initializing the element before I have any intent or invoice.
I'm confirming payment with the intent
(with the client secret)
My flow:
- Initialize Stripe elements
- When user submits form, request client secret from server
- Server generates invoice and invoice item and finalizes invoice
- Server returns client secret from Payment Intent on the finalized Invoice
- Client runs
confirmPaymentwith the client secret to process the payment
👋 stepping in as Pompey needs to step away
Sounds like you are having an issue with combining the deferred intent flow with creating one-off Invoices? Is that correct?
yess I believe that sums it up?