#MarcusStripe
1 messages · Page 1 of 1 (latest)
You should be able to expand any expandable objects on creation as far as I know. Are you getting an error?
thats the question
is it expandable?
the error.. I got it from a colleague.. and he just told me a nullPointer, so to be honest I ASSSUME it is the expand and then the missing secret
payment_intent string
expandable
The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.
seems it IS expandable.
but maybe I am using the wrong string for the expand?
Okay, so when the Invoice is created, it is not charged immediately after, so Payment Intent is going to be null in the response. I don't think our API will throw an error if you try to expand a null object, but obviously that doesn't satisfy what you're trying to do.
so.. how...
Can I add an expand to the invoice item creation instead?
invoiceItem.getPaymentIntentObject() - does not exist.. so probably... no.
You would need to do the expand at some point after the Invoice was paid. I would recommend listening for the invoice.paid webhook and then making a retrieve call to get the Invoice and expand payment_intent. Otherwise there's no way to know (programmatically) that payment_intent is not going to be null
well... the issue is that - a) AFAIK I need the payment intent to FINISH up this paymenty
so how would I get an invoice paid without it?
that sounds like a hen and egg problem
As long as the Customer on the Invoice has a valid Payment Method attached, then you can simply pay the Invoice. If it's on a Subscription, then the Invoice is paid automatically according to how your Subscription model is set up. If you are using Invoices as a standalone product (e.g. without Subscriptions) then you can call the invoice.pay API and pay the Invoice that way, which creates a Payment Intent automatically: https://stripe.com/docs/api/invoices/pay
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so.. you are saying.. I actually dont need the payment intent?
To take a payment? No. You won't need to manually create a Payment Intent to make a payment on an Invoice.