diff --git a/payment/gateway/paypal/amd/build/repository.min.js b/payment/gateway/paypal/amd/build/repository.min.js
new file mode 100644
index 00000000000..16eb7ec1674
--- /dev/null
+++ b/payment/gateway/paypal/amd/build/repository.min.js
@@ -0,0 +1,2 @@
+define ("pg_paypal/repository",["exports","core/ajax"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.getConfigForJs=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);var c=function(){return b.default.call([{methodname:"pg_paypal_get_config_for_js",args:{}}])[0]};a.getConfigForJs=c});
+//# sourceMappingURL=repository.min.js.map
diff --git a/payment/gateway/paypal/amd/build/repository.min.js.map b/payment/gateway/paypal/amd/build/repository.min.js.map
new file mode 100644
index 00000000000..ac239cda701
--- /dev/null
+++ b/payment/gateway/paypal/amd/build/repository.min.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["../src/repository.js"],"names":["getConfigForJs","Ajax","call","methodname","args"],"mappings":"2JAwBA,uDAOO,GAAMA,CAAAA,CAAc,CAAG,UAAM,CAMhC,MAAOC,WAAKC,IAAL,CAAU,CALD,CACZC,UAAU,CAAE,6BADA,CAEZC,IAAI,CAAE,EAFM,CAKC,CAAV,EAAqB,CAArB,CACV,CAPM,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * PayPal repository module to encapsulate all of the AJAX requests that can be sent for PayPal.\n *\n * @module pg_paypal/repository\n * @package pg_paypal\n * @copyright 2020 Shamim Rezaie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\n\n/**\n * Return the PayPal JavaScript SDK URL.\n *\n * @returns {Promise<{clientid: String, brandname: String}>}\n */\nexport const getConfigForJs = () => {\n const request = {\n methodname: 'pg_paypal_get_config_for_js',\n args: {},\n };\n\n return Ajax.call([request])[0];\n};\n"],"file":"repository.min.js"}
\ No newline at end of file
diff --git a/payment/gateway/paypal/amd/src/repository.js b/payment/gateway/paypal/amd/src/repository.js
new file mode 100644
index 00000000000..5310b9d255f
--- /dev/null
+++ b/payment/gateway/paypal/amd/src/repository.js
@@ -0,0 +1,39 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see .
+
+/**
+ * PayPal repository module to encapsulate all of the AJAX requests that can be sent for PayPal.
+ *
+ * @module pg_paypal/repository
+ * @package pg_paypal
+ * @copyright 2020 Shamim Rezaie
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+import Ajax from 'core/ajax';
+
+/**
+ * Return the PayPal JavaScript SDK URL.
+ *
+ * @returns {Promise<{clientid: String, brandname: String}>}
+ */
+export const getConfigForJs = () => {
+ const request = {
+ methodname: 'pg_paypal_get_config_for_js',
+ args: {},
+ };
+
+ return Ajax.call([request])[0];
+};
diff --git a/payment/gateway/paypal/classes/external/get_config_for_js.php b/payment/gateway/paypal/classes/external/get_config_for_js.php
new file mode 100644
index 00000000000..a1300aa028a
--- /dev/null
+++ b/payment/gateway/paypal/classes/external/get_config_for_js.php
@@ -0,0 +1,74 @@
+.
+
+/**
+ * This class contains a list of webservice functions related to the PayPal payment gateway.
+ *
+ * @package pg_paypal
+ * @copyright 2020 Shamim Rezaie
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+declare(strict_types=1);
+
+namespace pg_paypal\external;
+
+use external_api;
+use external_function_parameters;
+use external_value;
+use external_single_structure;
+
+defined('MOODLE_INTERNAL') || die();
+
+require_once($CFG->libdir . '/externallib.php');
+
+class get_config_for_js extends external_api {
+
+ /**
+ * Returns description of method parameters.
+ *
+ * @return external_function_parameters
+ */
+ public static function execute_parameters(): external_function_parameters {
+ return new external_function_parameters([]);
+ }
+
+ /**
+ * Returns the full URL of the PayPal JavaScript SDK.
+ *
+ * @return string[]
+ */
+ public static function execute(): array {
+ $config = get_config('pg_paypal');
+
+ return [
+ 'clientid' => $config->clientid,
+ 'brandname' => $config->brandname,
+ ];
+ }
+
+ /**
+ * Returns description of method result value.
+ *
+ * @return external_single_structure
+ */
+ public static function execute_returns(): external_single_structure {
+ return new external_single_structure([
+ 'clientid' => new external_value(PARAM_TEXT, 'PayPal client ID'),
+ 'brandname' => new external_value(PARAM_TEXT, 'Brand name'),
+ ]);
+ }
+}
diff --git a/payment/gateway/paypal/db/services.php b/payment/gateway/paypal/db/services.php
new file mode 100644
index 00000000000..dd66832081b
--- /dev/null
+++ b/payment/gateway/paypal/db/services.php
@@ -0,0 +1,36 @@
+.
+
+/**
+ * External functions and service definitions for the PayPal payment gateway plugin.
+ *
+ * @package pg_paypal
+ * @copyright 2020 Shamim Rezaie
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$functions = [
+ 'pg_paypal_get_config_for_js' => [
+ 'classname' => 'pg_paypal\external\get_config_for_js',
+ 'methodname' => 'execute',
+ 'classpath' => '',
+ 'description' => 'Returns the configuration settings to be used in js',
+ 'type' => 'read',
+ 'ajax' => true,
+ ],
+];
diff --git a/payment/gateway/paypal/lang/en/pg_paypal.php b/payment/gateway/paypal/lang/en/pg_paypal.php
index f64015e823b..0739395d01c 100644
--- a/payment/gateway/paypal/lang/en/pg_paypal.php
+++ b/payment/gateway/paypal/lang/en/pg_paypal.php
@@ -22,6 +22,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+$string['brandname'] = 'Brand name';
+$string['brandname_desc'] = 'The optional label that overrides the business name in the PayPal account on the PayPal site.';
+$string['clientid'] = 'Client ID';
+$string['clientid_desc'] = 'The client ID that PayPal generated for your application.';
$string['gatewaydescription'] = 'PayPal is an authorised payment gateway provider for processing credit card transactions.';
$string['gatewayname'] = 'PayPal';
$string['pluginname'] = 'PayPal';
diff --git a/payment/gateway/paypal/settings.php b/payment/gateway/paypal/settings.php
index 0c07be168af..d417defaebd 100644
--- a/payment/gateway/paypal/settings.php
+++ b/payment/gateway/paypal/settings.php
@@ -27,4 +27,8 @@ defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_heading('pg_paypal_settings', '', get_string('pluginname_desc', 'pg_paypal')));
+ $settings->add(new admin_setting_configtext('pg_paypal/brandname', get_string('brandname', 'pg_paypal'),
+ get_string('brandname', 'pg_paypal'), '', PARAM_TEXT));
+ $settings->add(new admin_setting_configtext('pg_paypal/clientid', get_string('clientid', 'pg_paypal'),
+ get_string('clientid_desc', 'pg_paypal'), '', PARAM_TEXT));
}