php - Authorize.net 对 ARB 订阅申请一次现金折扣
问题描述
是否可以对自动定期计费订阅应用一次/多次现金折扣?我似乎无法在 Google 上找到任何内容。
我目前拥有的:
- 首先计算折扣价,然后使用新价格创建单笔费用,并手动创建本地订阅(不再是 ARB),我必须在该订阅上创建自己的计费计划程序。
我想要实现的是这样的:
- 在订阅的第一个月和/或第二个月申请 100 美元
- 应用 2 次折扣后,订阅价格应在下一次结算时恢复为原始价格。
我正在为 authorize.net 使用Laravel 收银员包,所以我想添加一个功能,比如->withDiscount()
和->discountUsage()
$user->newSubscription('main', $planId)
->skipTrial()
->withDiscount(100) // these are the functions I want to achieve
->discountUsage(2) // the number of times discount is applicable
->create($user->authorize_id, [
'email' => $user->email_address
]);
我认为 Authorize.net 当前的ARB API可以实现吗?有人可以启发我或提供一些建议以获得更好的选择。谢谢!
解决方案
如果您只想降低前一两次付款的价格,您可以使用 ARB 中的试用期功能。这允许您在对剩余付款收取正常价格之前,为一定数量的付款设置不同的(通常较低的)价格。
我不知道您正在使用的软件包,但在第二行中您正在积极禁用此功能。
$user->newSubscription('main', $planId)
->skipTrial() // <-- HERE. This needs to be changed to enable the trial period.
->create($user->authorize_id, [
'email' => $user->email_address
]);
您需要阅读该库的文档以了解如何为 ARB 设置试用期。
看起来您可以在配置中进行设置:
'monthly-10-1' => [
'name' => 'main',
'interval' => [
'length' => 1, // number of instances for billing
'unit' => 'months' //months, days, years
],
'total_occurances' => 9999, // 9999 means without end date
'trial_occurances' => 0,
'amount' => 9.99,
'trial_amount' => 0, <-- HERE
'trial_days' => 0, <-- AND HERE
'trial_delay' => 0, // days you wish to delay the start of billing
]
最重要的是,您想做的事情是可能的。
推荐阅读
- python - 如何使用 numpy 向量化两个嵌套的 for 循环?
- github - 我如何从 GitHub 获取这个项目?
- javascript - MUI DataGrid 中的 checkboxSelection 可以区分单次检查和多次检查吗?
- python - Python Pandas:基于相同的 id 和相同的日期删除重复的行(仅保留第一行)
- php - 数组内爆导致 RabbitMQ 接收到空的 msg 正文,但其他发布者显示正文
- forms - WTForm modelform 不显示数据库记录中的复选框值
- python - 如何将值传递给 Django 自定义模板标签的函数
- c++ - 如何在 macOS 上导入 openssl/sha.h 或 openssl/md5.h
- string - while循环如何与字符串拼接一起找出字符串的长度?
- javascript - 在 JS 脚本中推送 PHP 数组