Get stripe invoice obj correctly

This commit is contained in:
PCoder 2020-02-01 12:23:47 +05:30
parent d8482c52f9
commit 9d21181073

View file

@ -1693,9 +1693,10 @@ class VirtualMachineView(LoginRequiredMixin, View):
inv_url = None inv_url = None
if hosting_order.subscription_id: if hosting_order.subscription_id:
stripe_obj = stripe.Invoice.list( stripe_obj = stripe.Invoice.list(
subscription=hosting_order.subscription_id subscription=hosting_order.subscription_id,
count=0
) )
inv_url = stripe_obj[0].data.hosted_invoice_url inv_url = stripe_obj.data[0].hosted_invoice_url
elif hosting_order.stripe_charge_id: elif hosting_order.stripe_charge_id:
stripe_obj = stripe.Charge.retrieve( stripe_obj = stripe.Charge.retrieve(
hosting_order.stripe_charge_id hosting_order.stripe_charge_id