Closed firepmi closed 7 years ago
I deployed php braintree on heroku I tried to get client token on the server but it says "[BraintreeSDK] ERROR Invalid client token. Please ensure your server is generating a valid Braintree ClientToken. [BraintreeSDK] ERROR BTClient could not initialize because the provided clientToken was invalid" here is my code
iOS code [[[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://[myapp].herokuapp.com/client_token.php"] completionHandler:^(NSData _Nullable data, NSURLResponse _Nullable response, NSError * _Nullable error) {
NSString *clientToken = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"Client Token: %@",clientToken);
self.braintreeClient = [[BTAPIClient alloc] initWithAuthorization:clientToken];
[self tappedMyPayButton];
//[self showDropIn:clientToken];
paynow = true;
}] resume];
php heroku <?php require_once("../includes/braintree_init.php"); ?> <?php echo(Braintree\ClientToken::generate()); ?>
Please give me advise Thanks
When you log the client token, is there a value for the client token? Can the text response be base64 decoded? For iOS specifically, I would ensure that you're using a https
URL since iOS 9+ requires additional App Transport Security configuration when talking to http
URLs. I think Heroku serves all deployed apps over https
for free if you use a Heroku subdomain, and it meet the App Transport Security requirements.
Sorry for the delay in response. You can contact support for specific integration information as well.
Closing due to inactivity. If this is still an issue, please leave a comment or contact (Braintree Support](https://developers.braintreepayments.com/forms/contact), and we'll reopen. Thanks!
Hi, we are getting the same error creating a BTAPIClient with the clientToken.
[BraintreeSDK] ERROR BTClient could not initialize because the provided clientToken was invalid [BraintreeSDK] ERROR Invalid client token. Please ensure your server is generating a valid Braintree ClientToken.
We are using: Braintree (4.17.0) and BraintreeDropIn (6.4.0)
Thx!
General information
Issue description