diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang
index 0a376ca9fb1..3ea0cf2354b 100644
--- a/htdocs/langs/en_US/stripe.lang
+++ b/htdocs/langs/en_US/stripe.lang
@@ -68,4 +68,5 @@ ToOfferALinkForTestWebhook=Link to setup Stripe WebHook to call the IPN (test mo
ToOfferALinkForLiveWebhook=Link to setup Stripe WebHook to call the IPN (live mode)
PaymentWillBeRecordedForNextPeriod=Payment will be recorded for the next period.
ClickHereToTryAgain=Click here to try again...
-CreationOfPaymentModeMustBeDoneFromStripeInterface=Due to Strong Customer Authentication rules, creation of a card must be done from Stripe backoffice. You can click here to switch on Stripe customer record: %s
\ No newline at end of file
+CreationOfPaymentModeMustBeDoneFromStripeInterface=Due to Strong Customer Authentication rules, creation of a card must be done from Stripe backoffice. You can click here to switch on Stripe customer record: %s
+TERMINAL_LOCATION=Location (address) for terminals
\ No newline at end of file
diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php
index d61d03b2be6..67e0c26ce8c 100644
--- a/htdocs/stripe/admin/stripe.php
+++ b/htdocs/stripe/admin/stripe.php
@@ -227,10 +227,10 @@ if (empty($conf->stripeconnect->enabled)) {
print '
';
}
@@ -386,7 +386,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
// Locations for Stripe Terminal
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '
';
- print $langs->trans("STRIPE_LOCATION").'
';
+ print $langs->trans("TERMINAL_LOCATION").'
';
$service = 'StripeTest';
$servicestatus = 0;
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
@@ -395,7 +395,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
}
global $stripearrayofkeysbyenv;
$site_account = $stripearrayofkeysbyenv[$servicestatus]['secret_key'];
- \Stripe\Stripe::setApiKey($site_account);
+ if (!empty($site_account)) {
+ \Stripe\Stripe::setApiKey($site_account);
+ }
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
$servicestatus = '0';
@@ -405,30 +407,34 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
$servicestatus = '1';
}
$stripe = new Stripe($db);
- $stripeacc = $stripe->getStripeAccount($service);
- if ($stripeacc) {
- $locations = \Stripe\Terminal\Location::all('', array("stripe_account" => $stripeacc));
- } else {
- $locations = \Stripe\Terminal\Location::all();
+ if (!empty($site_account)) {
+ // If $site_account not defined, then key not set and no way to call API Location
+ $stripeacc = $stripe->getStripeAccount($service);
+ if ($stripeacc) {
+ $locations = \Stripe\Terminal\Location::all('', array("stripe_account" => $stripeacc));
+ } else {
+ $locations = \Stripe\Terminal\Location::all();
+ }
}
+
$location = array();
- $location[""] = $langs->trans("EmptyLocation");
+ $location[""] = $langs->trans("NotDefined");
foreach ($locations as $locations) {
$location[$locations->id] = $locations->display_name;
}
- print $form->selectarray("STRIPE_LOCATION", $location, $conf->global->STRIPE_LOCATION);
+ print $form->selectarray("STRIPE_LOCATION", $location, getDolGlobalString('STRIPE_LOCATION'));
print '
';
}
// Activate Payment Request API
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '