【问题标题】:How to know if a Recurly subscription will renew at the end of its period?如何知道定期订阅是否会在其期限结束时续订?
【发布时间】:2016-02-11 05:41:43
【问题描述】:

在 Recurly 网站上查看有效的非续订订阅时,例如

https://xxxxxx.recurly.com/subscriptions/xxxxxxxxba354d5b84812419xxxxxxxx

Recurly 网站显示如下信息:

状态:活动
开始日期:UTC 时间 2016 年 2 月 9 日晚上 7:44
当前期间:2016 年 2 月 9 日 — 2016 年 3 月 9 日
下一张发票:不会续订
计费周期:剩余 0 次续订(共 1 次)
结束日期:UTC 时间 2016 年 3 月 9 日晚上 7:44

使用 Recurly API 查找相同的订阅,我无法弄清楚如何确定订阅是否会续订。这是 PHP,但语言无关紧要:

const TFORMAT = "D d M H:i:s \U\T\C Y";
$sub = Recurly_Subscription::get('xxxxxxxxba354d5b84812419xxxxxxxx');
echo $sub->state;
echo '<br>' . ($sub->activated_at ? $sub->activated_at->format(TFORMAT) : "nope");
echo '<br>' . ($sub->current_period_started_at ? $sub->current_period_started_at->format(TFORMAT) : "nope");
echo '<br>' . ($sub->current_period_ends_at ? $sub->current_period_ends_at->format(TFORMAT) : "nope");
echo '<br>' . ($sub->expires_at ? $sub->expires_at->format(TFORMAT) : "nope");
echo '<br>' . ($sub->canceled_at ? $sub->canceled_at->format(TFORMAT) : "nope");

这个输出:

活跃
2016 年 2 月 9 日星期二 19:44:48 UTC
2016 年 2 月 9 日星期二 19:44:48 UTC
2016 年 3 月 9 日星期三 19:44:48 UTC
没有
没有

如何确定此订阅是否会续订?

【问题讨论】:

    标签: recurly


    【解决方案1】:

    将我的请求发送给 Recurly Support 并得到了回复。希望它对未来的人有所帮助:

    订阅具有固定的 计费周期数不续订。订阅详情 API 此类订阅的调用将暴露以下内容 参数:

    • total_billing_cycles

    • remaining_billing_cycles

    这些参数不会在可更新订阅中公开。

    因此,通过在详细信息调用中添加 (PHP) 这些行将 ID 订阅是否为非续订订阅:

    //测试判断total_billing_cycles参数是否为 暴露/呈现

      if (isset($subscription->total_billing_cycles)) {
        // If true...do something
        echo "This subscription will not renew";
      }
    

    我希望这能回答您的问题。再次感谢你。问候,

    伊恩定期支持

    【讨论】:

      【解决方案2】:

      我从未使用过 Recurly,但您似乎首先必须获得订阅发票。

      当你有发票时,你可以使用

      <state>open</state>
      

      <collection_method>automatic</collection_method>
      

      计算是否续订。

      【讨论】:

      • 没有。那是特定于发票的。每个订阅可以有许多发票。可以在重复订阅时收集特定发票,而目前可能不再重复。
      猜你喜欢
      • 2011-09-24
      • 1970-01-01
      • 2015-05-26
      • 2014-11-18
      • 1970-01-01
      • 2018-12-06
      • 2016-01-20
      • 2017-01-07
      • 1970-01-01
      相关资源
      最近更新 更多