From 2abfd7fc5ec636a6ff8d74db26721675ef6b2d66 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 16 Oct 2021 23:17:49 -0600 Subject: [PATCH] feature: enable 'live' API mode --- paypal-checkout.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/paypal-checkout.js b/paypal-checkout.js index aba8fa7..1a37af2 100644 --- a/paypal-checkout.js +++ b/paypal-checkout.js @@ -19,8 +19,14 @@ PayPal.init = function (client_id, client_secret, env, opts) { opts.prefer = "return=representation"; } - PayPal.__sandboxUrl = "https://api-m.sandbox.paypal.com"; - PayPal.__baseUrl = PayPal.__sandboxUrl; + PayPal.__sandboxApiBaseUrl = "https://api-m.sandbox.paypal.com"; + PayPal.__liveApiBaseUrl = "https://api.paypal.com"; + if ("live" === env) { + PayPal.__baseUrl = PayPal.__liveApiBaseUrl; + } else { + PayPal.__baseUrl = PayPal.__sandboxUrl; + console.debug("[PayPal Checkout] ENVIRONMENT=sandbox"); + } PayPal.__id = client_id; PayPal.__secret = client_secret; PayPal.__defaultQuery = {