diff --git a/src/storefront/payments.py b/src/storefront/payments.py index 2a7bc5a..6a26ec2 100644 --- a/src/storefront/payments.py +++ b/src/storefront/payments.py @@ -3,7 +3,7 @@ import sys import json import logging -from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment +from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment, LiveEnvironment from paypalcheckoutsdk.orders import OrdersCreateRequest, OrdersCaptureRequest from paypalhttp.serializers.json_serializer import Json @@ -23,7 +23,10 @@ class PayPalClient: """Setting up and Returns PayPal SDK environment with PayPal Access credentials. For demo purpose, we are using SandboxEnvironment. In production this will be LiveEnvironment.""" - self.environment = SandboxEnvironment(client_id=self.client_id, client_secret=self.client_secret) + if settings.DEBUG: + self.environment = SandboxEnvironment(client_id=self.client_id, client_secret=self.client_secret) + else: + self.environment = LiveEnvironment(client_id=self.client_id, client_secret=self.client_secret) """ Returns PayPal HTTP client instance with environment which has access credentials context. This can be used invoke PayPal API's provided the