【问题标题】:Stripe - Get the LAST customer invoiceStripe - 获取最后一张客户发票
【发布时间】:2019-10-22 22:13:42
【问题描述】:

有没有办法根据为特定客户生成的最后一张发票过滤发票结果?

通过 Stripe documentation 我可以看到有可能获得即将到来的发票,但我找不到获得最后生成的发票的方法。

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    如果您使用的是条带式计费,则 subscription 包含 LatestInvoice - 因此您可以使用 latestInvoiceId,或者您可以获得订阅和 expand 它还返回最新的发票一击。

    【讨论】:

      【解决方案2】:

      您可以使用https://stripe.com/docs/api/invoices/list

      发票按创建日期排序返回,最近创建的发票显示在最前面。

      所以,如果您想要给定客户的最新信息

      invoices = stripe.Invoice.list(customer="cus_xxxyyyzzz")
      # first in the list should be the most recent
      print(invoices.data[0])
      

      【讨论】:

        猜你喜欢
        • 2020-12-22
        • 1970-01-01
        • 1970-01-01
        • 2014-03-08
        • 1970-01-01
        • 2019-01-11
        • 2019-03-13
        • 1970-01-01
        • 2021-01-31
        相关资源
        最近更新 更多