1

顧客プロファイル API を使用して、試用期間付きの月額サブスクリプション プランに authorize.net を使用しています。参考: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 で試行間隔を渡すには、どのパラメーターを使用しますか? これで私を助けてください。前もって感謝します。

4

1 に答える 1

2

これは、Authorize.Net 用語の試用期間ではありません。これは、サブスクリプションの開始が遅れているだけです。開始日を 1 週間後に設定し、1 か月の期間で通常のサブスクリプションを作成するだけです。ここでは、特別なコードやパラメーターは必要ありません。

したがって、特定の例では変更

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

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

または、動的に実行する場合:

$paymentSchedule->setStartDate(new DateTime('+7 days'));
于 2019-01-24T11:48:49.400 に答える