Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot create / update plan with addons

See original GitHub issue

General information

  • SDK/Library version: 5.12.0
  • Environment: Sandbox
  • C# .NET core 6

Issue description

I am able to create / update plans without addons, but when I need to assign addons to a plan (which has not been used for anything yet) or create plan with addon right away. I am getting AuthorizationException when I set Addons property in PlanRequest.

        PlanRequest planRequest = new PlanRequest
            Id = "my-plan",
            Name = "My plan",
            Description = "Awesome plan",
            BillingFrequency = 1,
            Price = 20,
            CurrencyIsoCode = "EUR",
            TrialPeriod = false,
            TrialDurationUnit = null,
            TrialDuration = null

         List<AddOn> addons = Gateway.AddOn.All().ToList();

         planRequest.AddOns = new List<AddOn>();

         foreach (var addonId in addons)

        var planResult = await Gateway.Plan.CreateAsync(planRequest);
Braintree.Exceptions.AuthorizationException: Exception of type 'Braintree.Exceptions.AuthorizationException' was thrown.
   at Braintree.HttpService.ThrowExceptionIfErrorStatusCode(HttpStatusCode httpStatusCode, String message) in D:\Git\CTB\Ctb.Platform.App\api\IoLabs.BrainTree\Gateway\HttpService.cs:line 340
   at Braintree.HttpService.GetHttpResponse(HttpRequestMessage request) in D:\Git\CTB\Ctb.Platform.App\api\IoLabs.BrainTree\Gateway\HttpService.cs:line 137
   at Braintree.BraintreeService.GetXmlResponse(String URL, String method, Request requestBody, FileStream file) in D:\Git\CTB\Ctb.Platform.App\api\IoLabs.BrainTree\Gateway\BraintreeService.cs:line 153
   at Braintree.BraintreeService.Post(String URL, Request requestBody) in D:\Git\CTB\Ctb.Platform.App\api\IoLabs.BrainTree\Gateway\BraintreeService.cs:line 48
   at Braintree.PlanGateway.Create(PlanRequest request) in D:\Git\CTB\Ctb.Platform.App\api\IoLabs.BrainTree\Gateway\PlanGateway.cs:line 46

When creating a plan I am getting all available addons first and the setting them to PlanRequest which allows to set them, sandbox website also allows to configure addons for plans so there is no reason why this library should not be able to do it.

I noticed tests also do not contain use case with addons and looking closer I noticed addons are not being properly serialized into the request.

xml coming to http call:

<?xml version="1.0" encoding="UTF-8"?><plan><billing-frequency>1</billing-frequency><currency-iso-code>EUR</currency-iso-code><description>xxx</description><id>xxx</id><name>xxx</name><price>20.00</price><trial-period>false</trial-period><add-ons>System.Collections.Generic.List'1[Braintree.AddOn]</add-ons></plan>

Delete plan method is missing completely on PlanGateway for no obvious reason, that would be nice as well for full CRUD capability like in sandbox web admin.

We would like to make this work so we can go live. This is part of customer’s admin interface.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

JadaVonRuthcommented, Dec 12, 2022

Thanks for noticing and reopening 😃

JadaVonRuthcommented, Mar 8, 2023

@saralvasquez awesome, thank you very much!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

My customers cannot add addons to their existing ...
My customers cannot add addons to their existing subscription · To set all addons to a plan select “All addons are applicable” and...
Read more >
Unable to access addons or upgrade plan online?
Unable to access addons or upgrade plan online? Try to visit the Manage Addons page, I get the following error ...
Read more >
Upgrading your published add-ons | Apps Script
Step 1: Make a copy of your add-on's Apps Script project; Step 2: Integrate Google Workspace Add-on; Step 3: Update your add-on's manifest....
Read more >
How to upgrade or downgrade add-ons?
Click the drop-down menu on the right-hand side of the add-on you want to upgrade; Click Modify Plan; Select the plan you want;...
Read more >
Upgrading your account and add-ons
Note: If you want to upgrade the capacity of an add-on, click Edit Current Plan on your current add-on, and then adjust the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found