我直接在Stripe仪表板中创建了一个客户并进行订阅,因为该客户是通过Stripe以外的支票+发票付款的。
Stripe每月都会发送与普通信用卡订阅类似的Webhooks,特别是发票Webhooks(from pandas import read_csv
from pandas import DataFrame
from pandas import Grouper
from matplotlib import pyplot
series = read_csv('carringtonairtemp.csv', header=0, index_col=0, parse_dates=True, squeeze=True)
groups = series.groupby(Grouper(freq='A'))
years = DataFrame()
for name, group in groups:
years[name.year] = group.values
years = years.T
pyplot.matshow(years, interpolation=None, aspect='auto')
pyplot.show()
,---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-7173fcbe8c08> in <module>
6 # display(group.head())
7 # print(group.values[:10])
----> 8 years[name.year] = group.values
e:\Anaconda3\lib\site-packages\pandas\core\frame.py in __setitem__(self, key, value)
3038 else:
3039 # set column
-> 3040 self._set_item(key, value)
3041
3042 def _setitem_slice(self, key: slice, value):
e:\Anaconda3\lib\site-packages\pandas\core\frame.py in _set_item(self, key, value)
3114 """
3115 self._ensure_valid_index(value)
-> 3116 value = self._sanitize_column(key, value)
3117 NDFrame._set_item(self, key, value)
3118
e:\Anaconda3\lib\site-packages\pandas\core\frame.py in _sanitize_column(self, key, value, broadcast)
3759
3760 # turn me into an ndarray
-> 3761 value = sanitize_index(value, self.index)
3762 if not isinstance(value, (np.ndarray, Index)):
3763 if isinstance(value, list) and len(value) > 0:
e:\Anaconda3\lib\site-packages\pandas\core\internals\construction.py in sanitize_index(data, index)
745 """
746 if len(data) != len(index):
--> 747 raise ValueError(
748 "Length of values "
749 f"({len(data)}) "
ValueError: Length of values (365) does not match length of index (252)
,invoice.updated
)和invoice.finalized
我的应用程序寻找以下网络连接来连接计费事件/实际上是在升级客户的帐户:
invoice.sent
customer.subscription.updated
一直是我经常使用的Webhook,以提醒我的应用程序更新客户的帐户(例如,提供每月收益)。我的问题是,使用发票时,实际上将发票标记为“已付款”要比生成发票的时间晚7-14天,并且应该更新帐户,因此我不能使用customer.created
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
charge.succeeded
等同于{ {1}}。
我试图弄清楚订阅续订上发送了哪些webhook,以供支票客户付款。 charge.succeeded
确实在续订时发生,但是可能会在计划变更时触发。与invoice.paid
相同-在计划变更时也可能发生。
是否有专门用于“续订此客户的订阅,而无论他们是否已经付款”的网络挂钩?
答案 0 :(得分:1)
没有专门的续订事件。您应该做的是监听customer.subscription.updated
事件,然后查看已更改的数据以评估它是否是续订。这个想法是在data[previous_attributes]
的{{1}}(doc)内部查看,并检查Event
和current_period_start
属性是否已更改,这表明更新了(或帐单周期更改)。