简体   繁体   English

如何使用Braintree在每月付款中每次折扣不同的值

[英]How discount different values each time in monthly payment using Braintree

I am using recurring payment from Braintree but it looks like they only allow to fix the bonus amount to subtract from each month payment. 我正在使用Braintree的定期付款,但看起来他们只允许固定从每月付款中减去的奖金金额。

https://developers.braintreepayments.com/javascript+php/guides/recurring-billing/plans#add-ons-and-discounts

However the bonus is different from each user and each month for each user. 但是,奖金与每个用户以及每个用户每月不同。 So do you have any idea to customize this ? 那么,您有什么想法对此进行自定义吗?

Thank you very much! 非常感谢你!

I work for Braintree. 我为Braintree工作。

You will need to create your custom add-ons and discounts in the Control Panel before they can be applied to your users' subscriptions. 您需要先在控制面板中创建自定义加载项和折扣,然后才能将其应用于用户的订阅。 After they are created, you can update users' add-ons and discounts as needed using Braintree_Subscription::Update . 创建它们之后,您可以根据需要使用Braintree_Subscription :: Update更新用户的加载项和折扣。

$result = Braintree_Subscription::update('theSubscriptionId', [
    'discounts' => [
        'add' => [
            [
                'inheritedFromId' => 'discountId1',
                'amount' => '7.00'
            ]
        ],
        'update' => [
            [
                'existingId' => 'discountId2',
                'amount' => '15.00'
            ]
    ],
    'remove' => ['discountId3']
    ]
]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM