使用不正确的应付金额更新条带计划
update stripe plan with incorrect amount due
我正在使用 stripe 付款。除了一件事,一切正常。
我有 4 个不同的计划:免费 (0€) / 免费 + 额外 (4,90€) / 高级 (49€) / 高级 + 额外 (53,90€)。
用户可以像那样更新订阅:
// i get the $plan variable by my ajax request
$newPlan = $plan;
// i find the name of the current user's plan in my database
$payment = $em->getRepository('CacPaymentBundle:Payment')->findOneByUser($id);
$customerId = $payment->getCustomerId();
// i update my user's stripe plan
$cu = \Stripe\Customer::retrieve($customerId);
$planId = $cu->subscriptions->data[0]->id;
$subscription = $cu->subscriptions->retrieve($planId);
$subscription->plan = $newPlan;
// i update my plan in my database
$subscription->save();
$payment->setPlan($newPlan);
$em->persist($payment);
$em->flush();
这是我的问题:在我的条纹后台,用户有正确的计划,但应付金额不正确。
当我更新为免费+额外到高级时,应付金额为 102 欧元和几美分
我不明白为什么我的金额不正确而我的计划是正确的
欢迎任何想法:)
谢谢
Stripe 计算订阅相对于时间的百分比。
这就是为什么我得到的数额不是我想要的数额
我正在使用 stripe 付款。除了一件事,一切正常。
我有 4 个不同的计划:免费 (0€) / 免费 + 额外 (4,90€) / 高级 (49€) / 高级 + 额外 (53,90€)。
用户可以像那样更新订阅:
// i get the $plan variable by my ajax request
$newPlan = $plan;
// i find the name of the current user's plan in my database
$payment = $em->getRepository('CacPaymentBundle:Payment')->findOneByUser($id);
$customerId = $payment->getCustomerId();
// i update my user's stripe plan
$cu = \Stripe\Customer::retrieve($customerId);
$planId = $cu->subscriptions->data[0]->id;
$subscription = $cu->subscriptions->retrieve($planId);
$subscription->plan = $newPlan;
// i update my plan in my database
$subscription->save();
$payment->setPlan($newPlan);
$em->persist($payment);
$em->flush();
这是我的问题:在我的条纹后台,用户有正确的计划,但应付金额不正确。
当我更新为免费+额外到高级时,应付金额为 102 欧元和几美分
我不明白为什么我的金额不正确而我的计划是正确的
欢迎任何想法:)
谢谢
Stripe 计算订阅相对于时间的百分比。
这就是为什么我得到的数额不是我想要的数额