#Nukesforbreakfast

1 messages ยท Page 1 of 1 (latest)

unkempt yewBOT
merry vector
#

Generally yes for the latest payment products (not for legacy products or API). What is your use case?

odd island
#

Well

#

I currently use stripe checkout to process payments

#

I'm looking to transition to invoices.

#

In the transition there will likely be some mix of both

#

It would be ideal to have one event type to listen to in order to keep the out of stripe balances in sync

merry vector
#

I see! I'd recommend using the corresponding event type to determine the successful payment instead of using one single event since not all information such as metadata will be populated to payment intent.

You may listen to checkout.session.completed event for Checkout Session and invoice.paid event for Invoice.

odd island
#

Oh, so metadata doesn't propagate to the other sub-types?

merry vector
#

Yep! Metadata won't be populated to other underlying objects

odd island
#

Interesting. I could have swore the charge or payment intent objects from the current checkout implementation were getting copies of the metadata added when creating the session...

#

They must be because I rely on the metadata to reconcile the successful payment to a specific account.

merry vector
#

Interesting! If you have a PaymentIntent ID (pi_xxx) to share, I'll be happy to take a look

odd island
#

Give me a bit

#

I'm looking up the code and a sample to confirm I'm not crazy....

merry vector
#

I might think of a case where it can be populated

merry vector
#

payment_intent_data.metadata is to set metadata on the underlying Payment Intent object

odd island
#

ok, looking...

merry vector
#

However, there's no similar field in Invoice, i.e. set the metadata in PaymentIntent object with Invoice API

odd island
#

yes, so I am setting payment_intent_data.metadata

#

and it looks like I'm actually currently handling charge.succeeded

#

and the charge object has that metadata.

#

evt_3MMJs5B7kbjcJ8Qq0vm9yoGx

#

is an example of an event that shows this

merry vector
#

With payment_intent_data.metadata will have metadata set in Payment Intent as the parameter is specifically for Payment Intent object.

However, invoice doesn't have similar field, so you won't get metadata set on the invoice in Payment Intent or Charges

odd island
#

ok

#

and I'm guessing the payment intent itself doesn't have any reference to what created it?

#

I guess it does have the invoice ID that created it as an attribute, so I could use that in a pinch if I wanted to.

merry vector
odd island
#

ok, switching gears a bit to a related topic: Right now in checkout I create the cart on demand based on the outstanding fees/fines for the user in question they need to pay. In invoicing land how do I do something similar at the end of the billing period? It looks like creating an invoice doesn't allow you to create line items? And the update API doesn't seem to either, so I'm not seeing how to add one off items to an invoice.

I've checked in other chats and with support and our fee/fine schedule doesn't quite fit into the stripe product/billing/subscription model.

merry vector
#

It looks like creating an invoice doesn't allow you to create line items?
Invoice works different. You'd create an empty invoice first, then add line items to the invoice. It's possible to create line items on the invoice. You may refer to the doc here: https://stripe.com/docs/invoicing/integration/quickstart

odd island
#

oh!

#

wait, am I understanding this right? I can create invoice items for a customer that are not associated to an invoice, and then the next invoice I create will automatically pick up those items?

merry vector
#

Sorry, I'm a bit confused. Are you talking about one-time payment using invoice or invoices on a subscription?

odd island
#

not using stripe subscriptions. It doesn't quite work for our use case.

#

so if I understand this right: throughout the month as they accrue fines, I can create invoice items as that happens. Then, at the end of the month, when I call

invoice = stripe.Invoice.create(
        customer=customer_id,
        collection_method='send_invoice',
        days_until_due=30,
    )

That created invoice will pick up all those unassociated invoice items?

merry vector
odd island
#

so much knowledge. So many options. Thank you!

merry vector
#

No problem! Happy to help ๐Ÿ˜„

odd island
#

@pale horizon do products/prices work with connect?

pale horizon
#

Hi, yes it should?

#

Sorry if I haven't grasped the context, but generally yes. You just need to make sure Products/Prices belongs to the correct Account (Platform or Connected)

odd island
#

ok, so in a destination charge scenario with an express account, am I able to use a product/price to create an invoice?

#

each connected account may have a different array of prices/products

pale horizon
#

destination charge means you are using data on your Platform account, just "redirect" some fund to your connected account, so the products/prices should belong to your Platform account

odd island
#

got it, so I can have the products/prices live on the main platform account