Stripe API - 收据列表 [英] Stripe API - Receipts Listing

查看:72
本文介绍了Stripe API - 收据列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Stripe API,我想向我的客户展示他们的发票历史列表以及相关收据.

I'm using the Stripe API and I'd like to present my customer's a list of their invoice history along with the relevant receipts.

我在 Stripe API 中找不到任何地方 (https://stripe.com/docs/api?lang=php),它允许我获取客户收据的列表.有什么我遗漏的吗?

I can't find anywhere in the Stripe API (https://stripe.com/docs/api?lang=php) that allows me fetch a list of a customer's receipts. Is there something I'm missing?

推荐答案

每张发票都包含一个 charge 属性,其中包含上次收费的 ID.这将是当前/最终付款尝试(对于未成功支付的发票)或成功付款(对于已支付的发票).

Each invoice includes a charge property which contains the id of its last charge. This will either be the current/final payment attempt (for invoices not successfully paid) or the successful payment (for paid invoices).

这使您可以轻松地使用费用和发票数据向用户提供收据,但收据"本身更像是一个应用程序端的概念;它的需求和表现因应用程序而异.

This allows you to easily use the charge and invoice data to present a receipt to the user, but a "receipt" is itself more of an application-side notion; its needs and presentation vary with the application.

获得数据后,您可以随心所欲地出示收据.

Once you've got the data, you can present a receipt however you like.

理想情况下,我建议在本地缓存这些记录.如果您收到 webhook,这几乎是无痛的.然后,您可以建模(和搜索!)最适合您需求的本地收据记录,您的客户随后将受益于非常快速的帐单显示,我们都将受益于 Stripe API 端点的负载减少.

Ideally, I recommend caching these records locally. It's almost painless to do if you're receiving webhooks. You can then model (and search!) a local receipt record as best fits your needs, your customer then gets the benefit of very fast billing display, and we all get the benefit of less load on Stripe's API endpoints.

这篇关于Stripe API - 收据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆