【问题标题】:How to set trial period interval in authorize.net?如何在 authorize.net 中设置试用期间隔?
【发布时间】:2019-06-18 02:29:29
【问题描述】:

我正在使用 authorize.net 进行月度订阅计划,试用期使用客户资料 API。 参考:https://developer.authorize.net/api/reference/#recurring-billing-create-a-subscription-from-customer-profile 我想设置订阅试用期的间隔。在 api 中,我无法与试用期的间隔相关联。 场景:如果我在 2019 年 1 月 1 日订阅,那么用户将获得 7 天的第一个试用期。因此,试用结束日期必须是 2019 年 8 月 1 日,金额为 0。那么实际订阅结束日期必须是 2019 年 8 月 2 日(试用期后 1 个月)和 100 订阅量。

$subscription = new AnetAPI\ARBSubscriptionType();
$subscription->setName("Sample Subscription");

$interval = new AnetAPI\PaymentScheduleType\IntervalAType();
$interval->setLength('30');
$interval->setUnit("days");

$paymentSchedule = new AnetAPI\PaymentScheduleType();
$paymentSchedule->setInterval($interval);
$paymentSchedule->setStartDate(new DateTime('2019-01-01'));
$paymentSchedule->setTotalOccurrences("9999");
$paymentSchedule->setTrialOccurrences("1");

$subscription->setPaymentSchedule($paymentSchedule);
$subscription->setAmount(100);
$subscription->setTrialAmount("0.00");

使用什么参数我可以在 authorize.net 中传递试用间隔?请帮我解决这个问题。 提前致谢。

【问题讨论】:

    标签: php authorize.net recurring-billing authorize.net-arb


    【解决方案1】:

    这不是 Authorize.Net 条款中的试用期。这只是开始订阅的延迟。您需要做的就是将开始日期设置为一周后,然后创建一个为期一个月的正常订阅。这里不需要特殊的代码或参数。

    所以在你的具体例子中改变

     $paymentSchedule->setStartDate(new DateTime('2019-01-01'));
    

    $paymentSchedule->setStartDate(new DateTime('2019-01-08'));
    

    或者如果您希望它动态完成:

    $paymentSchedule->setStartDate(new DateTime('+7 days'));
    

    【讨论】:

      猜你喜欢
      • 2015-02-09
      • 1970-01-01
      • 2011-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      相关资源
      最近更新 更多