logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
charles25686713  
#1 Posted : Friday, December 6, 2024 4:28:06 PM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Hi, I'm trying to test out braintree integration with their sandbox.

This is using 9.0.9.

I believe I have the gateway configured correctly with a merchant id and token.

When I try using it, InialializeBraintreeJS throws an out of bound exception here:

clientToken = braintreeProvider.GenerateClientToken(AbleContext.Current.UserId);

which is inside a try/catch, which makes me think this isn't out of the ordinary?

This happens before I get to the payment page.

On the actual payment page, the "processing" never finishes.

This is the full exception:

-
Exception: Index was outside the bounds of the array. Stack Trace: at Braintree.CredentialsParser.GetEnvironment(String credential) at Braintree.CredentialsParser..ctor(String accessToken) at Braintree.Configuration.set_AccessToken(String value) at Braintree.Configuration..ctor(String accessToken) at Braintree.BraintreeGateway..ctor(String accessToken) at CommerceBuilder.Payments.Providers.PayPalBraintree.BraintreeProvider.get_Gateway() at CommerceBuilder.Payments.Providers.PayPalBraintree.BraintreeProvider.GenerateClientToken(Int32 userId) at AbleCommerce.Controllers.CheckoutController.IntializeBraintreeJS(PaymentGateway braintreeGateway, IEnumerable`1 cardTypes) in Controllers\CheckoutController.cs:line 1537
-

EDIT: I get the same error with out of box code, unmodified.

Please advise.

Thanks,
Charles

Edited by user Friday, December 6, 2024 5:05:04 PM(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

charles25686713  
#2 Posted : Friday, December 6, 2024 5:42:05 PM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
I dug into Braintree.CredentialsParser.GetEnvironment(String credential) and it appears it's expecting the credential to be delimited with $:

-
private Environment GetEnvironment(string credential)
{
char[] chArray = new char[1]{ '$' };
return Environment.ParseEnvironment(credential.Split(chArray)[1]);
}
-

This leads me to believe I don't have the correct token in my sandbox setup?

The AC merchant guide isn't very helpful when it says:

-
Access Token = Your Braintree Access Key
-

what exactly is Braintree Access Key, and where do I get it? I see all sorts of info in the braintree sandbox API listing, but nothing that says "Access Key".

I'm currently trying to use a "tokenization key", which looks to be delimited by underscores. It starts with "sandbox_".

Thanks.

Edited by user Friday, December 6, 2024 5:43:13 PM(UTC)  | Reason: Not specified

Katie S  
#3 Posted : Sunday, December 8, 2024 11:45:49 AM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hello,

If you are trying to connect manually instead of using the Oath, then I believe you need to use a Tokenization key.

Here are a few links from Braintree that might be of help:

https://developer.paypal...ation-key/javascript/v3/

https://developer.paypal...tant-gateway-credentials

Let me know if this helps. I don't have access to a Braintree sandbox account at the moment.





Thanks for your support!

Katie
Secure eCommerce Software and Hosting
charles25686713  
#4 Posted : Sunday, December 8, 2024 11:53:28 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Hi, I'm not sure what you mean?

I'm using the braintree plugin in AC, referenced here:

https://help.ablecommerc...Gateways%2FBraintree.htm

I'm using a tokenization token, and am getting the above error.

There's nothing on the merchant guide that says we're using OAuth??
Katie S  
#5 Posted : Sunday, December 8, 2024 1:59:40 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
When you use the "Connect to Braintree Payment Gateway" instructions, that is using Oauth. Otherwise, there are some links that allow you to bypass and manually enter the Access Token per step. 3 of "Configure Braintree Payment Gateway" instructions.


Quote:
This leads me to believe I don't have the correct token in my sandbox setup?


The links I provided should help you to obtain the correct access token. If not, maybe you can try to connect by using the "Connect with Braintree" button link provided on the setup screen.

Have you turned on debug for the gateway and checked inside the log file?
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
charles25686713  
#6 Posted : Monday, December 9, 2024 9:50:09 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Hi, the OAuth automation worked, and I ended with a $ delimited access token, as the code implies it requires.

For future reference, the Access Token is from OAuth in Connected Apps. It is NOT a tokenization key or anything else under the API.

It would be helpful if the merchant guide was updated to properly reflect this? Right now, all the merchant guide says for manual setup is "Access Token = Your Braintree Access Key".

Thanks,
Charles
Katie S  
#7 Posted : Monday, December 9, 2024 10:17:36 AM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hi Charles,

This might be a bug. The manual entry of the key was supposed to allow access if you do not use the Oauth connection. I will need to check with the developers and find out for sure.

Either way, I agree the documentation is too vague and needs to be fixed.

Thanks for providing an update. Really appreciate that.
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
charles25686713  
#8 Posted : Monday, December 9, 2024 10:20:44 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Katie S Go to Quoted Post
Hi Charles,

This might be a bug. The manual entry of the key was supposed to allow access if you do not use the Oauth connection. I will need to check with the developers and find out for sure.

Either way, I agree the documentation is too vague and needs to be fixed.

Thanks for providing an update. Really appreciate that.


I can manually enter the data. The challenge not knowing what data to enter!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.