Search code examples
node.jsbraintree

Braintree "Subscriptions" and "Add Ons"


Question 1:

For braintree is it correct to use Add Ons with number of billing cycle of 1 to collect deposit?

I'm trying to implement subscriptions where user will pay a monthly fee. However, during first time sign-up I would like the user to place a deposit.

gateway.subscription.create({
    paymentMethodToken: result.customer.paymentMethods[0].token,
    planId: "platinumPlanID"
}, function (err, result) {
    console.log('subscription result:', result);
    console.log('subscription err:', err);
    res.send(result)
});

enter image description here

Question 2:

How to simulate if the subscription is working accordingly?

Question 3:

How to retrieve user's payment history for monthly subscriptions?


Solution

  • Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

    If you wish to have the initial subscription amount and the deposit charged under the same transaction, then using the 1 time add on as you have mentioned will achieve this.

    Another way to achieve this would be to charge the deposit as a 1 time transaction (as opposed to a subscription) by using the transaction.sale call. Then, if this initial transaction is successful, you can create the subscription.

    Either of these options will work, so it is a matter of a personal preference between splitting the deposit and the subscription, or having them go through on the same transaction.

    For question 2: You can test out your subscription logic by using our sandbox environment and creating subscriptions within the sandbox.

    For question 3: You can reference the transactions array within the subscription object to review past transactions for a specific subscription. You can also run a subscription search within the Control Panel.