#mr_pablo

1 messages · Page 1 of 1 (latest)

swift ploverBOT
uncut crater
#

Unfortunately there isn't a direct way to do that really. PaymentIntent's themselves don't use product/price information. Products and prices work with our Billling products (Subscriptions and Invoices)

#

So basically, you can use associate them with the intent if you want, but that would look something like putting their IDs in the PaymentIntent's metadata.

brisk tiger
#

So we are looking to use Stripe Elements on our site, rather than the off-site checkout. The docs state we need to use the Payment Intent API for Elements. Does this mean Elements doesn't work with Products?

uncut crater
#

Correct, PaymentIntents work with things that use Products and Prices, but they don't directly interact with Products and Prices themselves.

brisk tiger
#

Sorry but that makes no sense

uncut crater
#

The closest thing to that would be if you create one off Invoices. Those use Products and Prices and will automatically create/update a PaymentIntent with the proper amount.

brisk tiger
#

right OK

uncut crater
#

So you can do that and when you want to see the products and prices you can look them up via the invoice property on the payment intent

brisk tiger
#

And does Stripe Elements support Invoices?

uncut crater
#

Elements can use the PaymentIntent that an Invoice creates

#

So elements won't automatically show price and product info, but it will still let you confirm the payment for that invoice

brisk tiger
#

OK, we'll take a look at the Invoices API

#

And I cannot see any mention of Payment Intents when creating an invoice

uncut crater
brisk tiger
#

How do I say what Product the Invoice is for?

uncut crater
#

The product IDs won't be directly on the Invoice, they will be on the invoice items' prices

brisk tiger
#

right, so, I need the Invoice AND Invoice Item APIs?

uncut crater
#

Correct

brisk tiger
#

How do I connect an Invoice to Invoice Item? Can't see anyway to do that

uncut crater
#

2 ways, you can either create the invoice and then the items or the items then the invoice.

  1. If you create the invoice then the items, pass in the invoice's ID to the invoice parameter when creating the items https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-invoice
  2. If you want to create the items first, create the items without that parameter. When creating the invoice pass in a pending_invoice_items_behavior of include. That will make sure that all pending invoice items on the customer get added to the invoice. https://stripe.com/docs/api/invoices/create#create_invoice-pending_invoice_items_behavior
brisk tiger
#

Ok, got ya

uncut crater