#danilabagroff
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- danilabagroff, 1 hour ago, 71 messages
- danila-list-pagination, 1 day ago, 11 messages
Hello happy to help. Can you summarize where the last thread left off and what you have found since?
Hi! I'm back with minimal example, please take a look:
`shop = "Stripe.Com"
guid = uuid.uuid1()
customer_id = "cus_PMYSZs7BbA42QW"
subscription_price_list = [
{
'price': "price_1NkL2KEPcSoIRKCHOZPUYFk9",
'quantity': 1
}
]
subscription = stripe.Subscription.create(
api_key = secret_key,
idempotency_key = "aerarium.stripe.Subscription.create({arg1},{arg2},{arg3})".format(arg1 = shop, arg2 = guid, arg3 = False),
metadata = {
'crn': "urn:cadabra:cloud :aerarium:subscription:{arg1}:{arg2}:{arg3}".format(arg1 = shop, arg2 = guid, arg3 = "no_tax")
},
automatic_tax = { 'enabled': False },
customer = customer_id,
items = subscription_price_list,
payment_behavior = 'default_incomplete',
expand = ['latest_invoice.payment_intent']
)`
please, pay attention on this: metadata = { 'crn': "urn:cadabra:cloud :aerarium:subscription:{arg1}:{arg2}:{arg3}".format(arg1 = shop, arg2 = guid, arg3 = "no_tax") }
Eventually, I have this metadata in the line which have no sense, what if we have several lines? all of them will have same metadata? what for?
In my opinion it should be used just in root metadata of subscription and invoice
recap
- subscription metadata is used in all lines - just confused
- unfortunately metadata is not used in the root metadata of an invoice - will be great if same metadata used twice and not just in the root of a subscription
Thanks for the info, I am still a bit unclear on the underlying issue. It looks like that metadata key and value are being properly set on the subscription for the code that you have. Are you looking to brea that up in to multiple metadata entries?
I will check if there is a way to set metadata on the invoices through the subscription but there may not be a parameter specifically for it
I think we have properties that show the metadata on the subscription at the time of the invoice creation, but I don't think we have a way to set that as the invoice's metadata automatically
Thank you! Now, I'm doing an extra call straight after the Subscription.create(), but it's not a "transactional way" 😦
but how about copying this metadata among all lines? Is this by design? Why all of them "inherites" metadata of a subscription?
Sorry for bothering you with this boring stuff, but we use a lot metadata as a glue between Stripe and our internal ERP system
As a general rule, metadata isn't automatically copied between our API objects, even related ones. For some common use cases like this one we built out functionality to share them in certain ways, but even then we keep the metadata from that separated from the actual object's metadata
Ah here we go subscription_details.metadata should have a copy of the subscription's metadata at the time the invoice was created https://docs.stripe.com/api/invoices/object#invoice_object-subscription_details-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
😦 sad