Gihan
Gihan

Reputation: 2536

Braintree how do I change the subscription lifecycle period?

I am new to braintree and I am implementing a braintree payment gateway for my nodeJs app. I have few concerns when it come to application testing.

  1. How can I change the period of one billing cycle. Currently its limited to minimum of 1 month. If it is not changeable what is the workaround for testing multiple billing cycle transactions ??

PS: I did refer to this how-can-i-change-subscription-period-on-braintree but a valid answer can not be found.

My next question is related to the webhooks in Braintree. When a webhook is triggered for successful charge for subscription it returns a Subscription object which a transaction array which includes all the transactions for that subscription. Is there a way to filter out the data for the transaction which the webhook was triggered for ? It says the array is sorted. Does that mean that 0th position of the transaction array is the last transaction made ??

Braintree Subscription object reference

Since the test environment does not let us change the billing cycle time I have to wait a month to test this. And if there is a better way to do handle this please advice me on it.

Upvotes: 0

Views: 573

Answers (1)

Dana K.
Dana K.

Reputation: 319

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

It’s not possible to create a subscription billing period shorter than a month in sandbox or production. The previous answer linked in your question — creating a subscription with a 1-day trial period — is a good way to test subscription billing transactions.

The array of transactions inside a subscription object is sorted by creation date with most recent first, so the first transaction within a subscription returned in a webhook notification will be the transaction that triggered the webhook.

You can also take a look at our webhooks testing page for examples of how to generate sample webhook notifications.

Upvotes: 1

Related Questions