如何:通过Paymill取消订阅后终止订阅
问题描述:
我已经设置了没有有效日期的按月订阅。如果有人取消其订阅它调用场景如何:通过Paymill取消订阅后终止订阅
$subscription->setId('sub_dea86e5c65b2087202e3');
->setRemove(false);
我没有得到任何有关被黄牌警告本期信息背后的以下功能。如果某人在9月1日订阅并在9月2日取消,我无法查明,如果他的订阅仍然有效。
答
既然有查询Paymill-API我已经做了以下没有内置的方式:
$subscription = $this->getClientSubscriptions(); //Get subscriptions for the client
if ($subscription)
{
if (! $subscription['is_canceled'])
{
$this->client->end_of_period = date('Y-m-d H:i:s', $subscription['next_capture_at']);
/* Set end of period within the database if
subscription is not canceled */
} elseif ($this->client->end_of_period < date('Y-m-d H:i:s'))
{
/* If the subscription has been canceled we can
compare the end of period to the current date
and set the subscription to false since it expired */
$this->client->end_of_period = null;
$subscription = false;
}
$this->client->save();
$this->cache->put($subscription_cache, $subscription, 1440);
/* Save and put it to cache to prevent excessive calls to the paymill-api */
}
如果有此解决方案的任何问题,我会很乐意回答他们。