You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Language, language version, and OS: Python 3.9.1 on a python:alpine docker container
Issue description
When I try and gateway.transaction.find a transaction using a gateway that was initialised with a client_id and secret, I receive a TypeError "can only concatenate str (not "NoneType") to str".
Had a look, this happens because the BraintreeGateway.merchant_id is not set if you initialise it using a client_id and secret.
Steps to reproduce:
# gateway using my credentialsgateway=braintree.BraintreeGateway(
client_id=os.getenv('BT_CID'),
client_secret=os.getenv('BT_SECRET')
)
result=gateway.transaction.sale({
"amount": '1.00',
"payment_method_nonce": 'fake-valid-nonce',
"options": {
"submit_for_settlement": True
}
})
transaction=result.transactionresult=gateway.transaction.find(transaction.id)
Traceback:
Traceback (most recent call last):
File "/test.py", line 89, in <module>
result = my_gateway.transaction.sale({
File "/usr/local/lib/python3.9/site-packages/braintree/transaction_gateway.py", line 84, in sale
return self.create(params)
File "/usr/local/lib/python3.9/site-packages/braintree/transaction_gateway.py", line 31, in create
return self._post("/transactions", {"transaction": params})
File "/usr/local/lib/python3.9/site-packages/braintree/transaction_gateway.py", line 168, in _post
response = self.config.http().post(self.config.base_merchant_path() + url, params)
File "/usr/local/lib/python3.9/site-packages/braintree/configuration.py", line 113, in base_merchant_path
return "/merchants/" + self.merchant_id
TypeError: can only concatenate str (not "NoneType") to str
The text was updated successfully, but these errors were encountered:
👋 @jvn145 thanks for reaching out. Creating a Braintree gateway using a client ID and client secret is only intended for oAuth management, not transaction management like transaction.sale calls. If you're trying to create a transaction using a shared vault, you'll need to create an access token first and create your gateway instance with that access token.
If you're not using an oAuth scenario to manage your vault and transact with a shared vault, you should be creating your gateway using API credentials. For any assistance with oAuth or setting up your gateway with API credentials, please contact Support.
All this said, this error message isn't helpful in understanding the limitations of making a gateway via oAuth, and we should definitely update the SDK to surface a better error message. I'll leave this issue open to track improving our error messaging around this scenario.
General information
Issue description
When I try and
gateway.transaction.find
a transaction using a gateway that was initialised with a client_id and secret, I receive aTypeError
"can only concatenate str (not "NoneType") to str".Had a look, this happens because the BraintreeGateway.merchant_id is not set if you initialise it using a client_id and secret.
Steps to reproduce:
Traceback:
The text was updated successfully, but these errors were encountered: