简体   繁体   中英

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.

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.

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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