#adambirds_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1407372325505990666
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there, can you share a request ID where you're encountering this problem? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Its hard for me to be 100% sure this is the correct ID (
req_5ycbaLyvOHdc5i), but basically its been in issue since I upgraded to basil where current_period_start was removed from the subcription object. But at least as far as I was able to figure out from the docs, .items.data[0].current_period_start should have worked but it doesn't seem to be.
can you share your code where you're trying to use .items.data[0].current_period_start? it ought to be there according to https://docs.stripe.com/api/subscriptions/object?api-version=2025-07-30.basil#subscription_object-items-data-current_period_end
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah so this is an example:
def handle_invoice_payment_succeeded(event: Dict[str, Any], webhook_event: WebhookEvent) -> None:
invoice = event["data"]["object"]
customer_id = invoice["customer"]
subscription_id = invoice["subscription"]
subscription, created = Subscription.objects.get_or_create(
customer=Customer.objects.get(stripe_customer_id=customer_id),
)
stripe_subscription: stripe.Subscription = stripe.Subscription.retrieve(subscription_id)
subscription.stripe_subscription_id = subscription_id
subscription.status = stripe_subscription.status
subscription.current_period_start = datetime.fromtimestamp(
stripe_subscription.items.data[0].current_period_start
)
subscription.current_period_end = datetime.fromtimestamp(
stripe_subscription.items.data[0].current_period_end
)
subscription.trial_end = (
datetime.fromtimestamp(stripe_subscription.trial_end)
if stripe_subscription.trial_end
else None
)
subscription.save()
## Check if created at time is close to now to avoid sending renewal email at signupm so if created at time is say in last 30 mins dont send renewal email
if not created and subscription.created_at < timezone.now() - timedelta(minutes=30):
send_successful_subscription_renewal_email.delay(
subscription.customer.user.email, subscription.customer.user.first_name
)
webhook_event.processed = True
webhook_event.save()