Set proper Paypal environment for production
This commit is contained in:
parent
03a2a8a417
commit
7e5985fdc7
@ -3,7 +3,7 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment
|
from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment, LiveEnvironment
|
||||||
from paypalcheckoutsdk.orders import OrdersCreateRequest, OrdersCaptureRequest
|
from paypalcheckoutsdk.orders import OrdersCreateRequest, OrdersCaptureRequest
|
||||||
from paypalhttp.serializers.json_serializer import Json
|
from paypalhttp.serializers.json_serializer import Json
|
||||||
|
|
||||||
@ -23,7 +23,10 @@ class PayPalClient:
|
|||||||
"""Setting up and Returns PayPal SDK environment with PayPal Access credentials.
|
"""Setting up and Returns PayPal SDK environment with PayPal Access credentials.
|
||||||
For demo purpose, we are using SandboxEnvironment. In production this will be
|
For demo purpose, we are using SandboxEnvironment. In production this will be
|
||||||
LiveEnvironment."""
|
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
|
""" Returns PayPal HTTP client instance with environment which has access
|
||||||
credentials context. This can be used invoke PayPal API's provided the
|
credentials context. This can be used invoke PayPal API's provided the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user