Tap-Payments / gosellSDK-Flutter

Flutter plugin for goSellSDK
MIT License
10 stars 26 forks source link

Invalid Api Key #6

Closed Hussain-AlBayyat closed 2 years ago

Hussain-AlBayyat commented 4 years ago

Hello,

I am getting this error {"errors":[{"code":"2104","description":"Invalid API Key"}]}

Please help

HaithamSheshtawy commented 4 years ago
  1. First you make sure that those credentials are valid and you already received them from tap.
  2. Open your app ios folder from Xcode and make sure you are setting bundle id in Xcode and it matches the one you gave to tap.
  3. Afterwards, you can try to test it from Xcode or from VSCode
  4. If you are using the same bundle id and same secrete key for both Android and iOS then you can pass it as bellow: GoSellSdkFlutter.configureApp( bundleId: "YOUR_BUNDLE_ID", productionSecreteKey:"YOUR_PRODUCTION_SECRETE_KEY", // if you don't have keep it empty sandBoxsecretKey: "YOUR_SANDBOX_SECRETE_KEY", lang: "en"); }
  5. If you have different bundle ids and different keys the use the following configurations GoSellSdkFlutter.configureApp( bundleId: Platform.isAndroid? "YOUR_ANNDROID_BUNDLE_ID":"YOUR_iOS_BUNDLE_ID", productionSecreteKey: Platform.isAndroid? "YOUR_ANDROID_PRODUCTION_KEY":"YOUR_iOS_PRODUCTION_KEY", // pass empty string if not exist sandBoxsecretKey: Platform.isAndroid? "YOUR_ANDROID_SANDBOX_KEY":"YOUR_iOS_SANDBOX_KEY", lang: "en"); }
Hussain-AlBayyat commented 4 years ago

I have made sure that the sandbox secrete_key is correct as well as bundleID.

However, according to your code: if (appCredentials["production_secrete_key"] == "" || appCredentials["production_secrete_key"] == "null" || appCredentials["production_secrete_key"] == null) { _prepareConfigurationsErrorMap( errorCode: ERROR_CODE_INVALID_APP_CONFIGURATION, errorMsg: 'Invalid secrete Key', errorDescription: 'Production Secrete key can not empty or null'); return false; } productionSecreteKey -> Can't be empty.

Another thing: appCredentials = <String, dynamic>{ "production_secrete_key": productionSecreteKey, "sandbox_secrete_key": sandBoxsecretKey, "bundleID": bundleId, <---------------- "language": lang };

But when you check for the bundleId in here: if(appCredentials["bundleId"] == "" || appCredentials["bundleId"] == "null" || appCredentials["bundleId"] == null) {} you are using "bundleId" not "bundleID" as used in appCredentials

Same here: if (appCredentials["lang"] == "" || appCredentials["lang"] == "null" || appCredentials["lang"] == null) {}

you are using "lang" not "language" as used in appCredentials

Futhermore, I think this line: if (!_validateSessionArge() || _validateAppConfig()) return _tapSDKResult; should be: if (!_validateSessionArge() || !_validateAppConfig()) return _tapSDKResult;

After all this, I am getting same error: {"errors":[{"code":"2104","description":"Invalid API Key"}]}

Please let me know how to proceed. Thanks

Hussain-AlBayyat commented 4 years ago

Any updates?

6h4n3m commented 3 years ago

I'm having the same issue, and apart from the fact that the code itself contains many magic strings... the above issue still persists.

Even when cloning your repo and trying your example code, it still gives the issue with the api key.

Edit: Flutter version is 1.22, platform is Android.

6h4n3m commented 3 years ago

I'm having the same issue, and apart from the fact that the code itself contains many magic strings... the above issue still persists.

Even when cloning your repo and trying your example code, it still gives the issue with the api key.

Edit: Flutter version is 1.22, platform is Android.

NVM, there was an issue with the bundle id registered with TAP, issue is resolved.

kareemTap commented 3 years ago

@Hussain-AlBayyat @6h4n3m You need to contact our support team to register your BundleID and generate the sandbox and production key, so you can be able to use our SDK.

abdullahehab commented 1 year ago

I have contact Tap support team and i face same issue right now @kareemTap

AliElsayed97 commented 1 year ago

i still have same issue here , any suggestion??