#shanedjrogers-checkout-card-support
1 messages ยท Page 1 of 1 (latest)
Ok thanks!
Ok, Ill just assume its card only for now
moving the context here
Can I also ask, why is there no price / product id included on a payment intent? Its only amount and currency and the associated charge object also has not product price id
I cant for example do a customer.payments.map(:product)
I can only do that if the payment is a subscription
pi_3KhicLANVVVLTo162TrUqKpc
How can I tell what product and price is associated with a payment intent? I can tell what product / price is associated with a subscription payment but not a payment intent
Taking a look at your payment intent
Ok thanks
Ah okay so the product and the price are associated to the checkout session and not the Payment Intent directly.
So if you retrieve the session again, you'd be able to see the product and the prices associated.
You'd want to look at the line_items on a session object
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
Yes but what about non checkout session created payment intents?
The only way I can seem to see how to do it is to use a headless browser to render the receipt url, parse out the line items and do a string match on product name and formatted price amount
If an account connects to my platform account, and that account has not been using stripe checkout, I cant figure out what their product / price sales history is
you can also use metadata and store product/price in it?
Yep could but my assumption is that these purchases have already occurred
How does Stripe know internally what payment intent maps to each product / price?
I can only see amounts and currency but theres no metadata to work with
AFAIK In order to use products and prices you'd have to use Checkout Sessions, Payment Links, Quotes, Subscriptions, or Invoices.
These will create the underlying Payment Intent. So really, the products and prices will be associated with one the above objects directly and not with a Payment Intent.
Yeah ok makes sense
Was wondering if there was a way for me to find the info but I guess there isnt
Except for the hacky render and parse the receipt page
I mean instead of relying on the Payment Intents you can rely on the objects that are creating those Payment Intents right? That'd also give you direct access to the product/prices
But what about for old transactions? How would that work? I haven't been able to figure that out yet
when you say old transactions, how old specifically?
If you have an example I'm happy to walk you through the process ๐
Ah sorry by old I mean any time in the past where my platform doesnt initiate the charge
So I cant put a product / price id in the payment_intent.metadata for retrieval later etc
Example is
Company A has sales via Stripe.
These sales use one time prices.
They have not been using Stripe checkout and they don't have any product / price metadata attached to the payment intent metadata
They then connect to my platform using Stripe Connect
My platform can pull a list of their account payments but cant tell what products / prices are associated with these payments
Okay so your platform will have access to all objects on the connected account
However, since PaymentIntent doesn't have any relation to product/prices you'd not be able to find the connection here.
If the connected account used not checkout but Payment Links, Quotes, Subscriptions, or Invoices, you can retrieve those objects and associate it with a payment intent and product/price
Yeah ok so same page
thanks for clarificaion
How does stripe associate these things when standard payment intents have been used?
Will it be exposed via the api in the future via the search api?
I think I'd recommend seeing Payment Intent as a secondary object and not the primary when to comes to associating it with a product/price.
Standard Payment Intents with just the amount may or may not have a price/product associated with them. Hence, we don't link them directly to a price/product.
Is there a primary object for a payment intent when not originating from Checkout / Payment Links / Quotes / Subscriptions / Invoices?
If not using these things, it'd be created using the API correct?
Yep
So it'd just be a PaymentIntent object
but you can't pass a price ID or a product ID when using the API
Yeah
Ok great thanks for the info
How does Stripe discern between which products and prices have been used when users just create payments via the API?
We don't. As there's nothing on the PaymentIntent object similar to line_items. Hence, the a workaround is to use the metadata to hold on to that information but it'd be up to the developer to set the metadata accordingly.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No worries ๐ Good Luck