Braintree Subscription Transactions, how to detect if billing was skipped?

948 views Asked by At

I am using braintree java sdk for subscriptions.

I have a subscription object, I would like to get a list of all transactions for this subscription.

I know there is a method named getTransactions() but this does not return all transactions that appear in my braintree vault.

Can anyone tell me how I can get a list of transactions including skipped transactions where the amount was 0.0?

When viewing a subscripton in the braintree vault you can see status "Billing Skipped", how can I produce a list like this in my own application using java? How does braintree do this?

Transactions List Produced In Braintree Vault

Thanks for your help.

1

There are 1 answers

1
Ryan Regan On

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

If you'd like to track skipped billing events via Braintree's API, you won't be able to query the subscription object directly for it. Subscription objects do contain an array of associated transactions, however this will not report skipped billing events. The billing skipped events you're seeing in the control panel are artifacts that exists only in the control panel and are not available directly via the API. Braintree's API does not permit a zero amount transaction, so there is not a means to deliver this event via a transaction object in the API.

If you'd like to implement a means to detect when a subscription creates a skipped billing event entirely within the API, we'd recommend using Braintree webhooks and specifically set up parsing to detect the subscription_charged_successfully webhook. This webhook will be sent to your server's URL for successful transactions as well as billing skipped events. This webhook itself will contain a timestamp, kind, and the subscription object it was sent for. The best means to use this to detect a billing skipped event would be to compare the timestamp from the webhook to the first transaction from the subscription object's transaction array (the first transaction in the array will always be the latest transaction), and look at the transaction's created_at timestamp. If the dates do not match, then you'll know this webhook was sent as a result of a billing skipped event.