How to mimic the status of past affairs in a subscription

I installed a PHP script in cron that binds Braintree through an API to see the status of each subscription we have in the file. Then we update our local records based on customer subscription status. Since I can manually unsubscribe from the Braintree dashboard, I was able to verify that my script can detect canceled subscriptions.

However, I cannot find a way to check past status, except to wait for the billing cycle to begin. Since the minimum billing cycle length in Braintree is one month, it makes it very difficult to debug my script.

I know that in theory I should just see a different line for the subscription status, but I'm looking for a reproducible way to mimic the past status, as well as the positive balance and value for daysPastDue.

Can anyone help?

$BT_subscription = Braintree_Subscription::find($BT_subscription_id); if ($BT_subscription && $BT_subscription instanceof Braintree_Subscription) { if ($BT_subscription->status == 'Past Due' && $BT_subscription->balance > 0) { // ... 
+6
source share
2 answers

I received the following response from Braintree support on this issue:

Since our sandbox environment is designed to replicate our production environment, there is no way to force a close subscription. However, there is a little work here that can facilitate this testing:

To place a subscription in the Past Due status in the Sandbox, you can create a subscription with a trial period of one day and costing $ 2,000. Then, when the one-day trial period expires, it will cause a transaction to be created that will not be completed due to the dollar amount.

The price of $ 2,000 is most likely for test amounts for unsuccessful transactions in order to result in a credit card payment failure. I installed the test and will edit it if the test fails.

+12
source

Adding Tyler V to the answer, and this is the only way to test it, unfortunately.

From support:

Thank you for contacting us and appreciate your patience. Using the account sandbox, the shortest amount of time that you can simulate will be 1 day. Use the following example to create past state status:

Create a plan with a 1-day trial and a price of $ 2,000. Create a customer with a credit card. Create a new subscription using the plan and customer. The first payment attempt will be after 1 day (when the trial version expires) and the failure Automatic retries will be for +10 and +20 days of subscription delay. See the next page for Sandbox test values. I would recommend that you create LOT of them at one time, so you have multipliers to work with; otherwise, you will have to wait one day for each new one they create in order to go to expired.

+2
source

Source: https://habr.com/ru/post/949511/


All Articles