How to create deeplink back to Python Kivy app

ericb75
Contributor
Contributor

Not quite sure if I'm in the right spot to post this, but my problem is I'm trying to create a deeplink that returns to my app after the user has confirmed the payment on PayPal. I have the PayPal Python SDK in my script and it works fine but up until the confirmation I'm just a bit lost on how to redirect it to my app to capture the order. Any help would be appreciated!

 

def PayPal(self)
client_id = "ID"
client_secret = "SECRET"

environment = SandboxEnvironment(client_id=client_id, client_secret=client_secret)
client = PayPalHttpClient(environment)

request = OrdersCreateRequest()
request.prefer("return=representation")

request.request_body({
"application_context": {
"return_url": ""},

"intent": "CAPTURE",

"purchase_units": [{
"amount": {
"currency_code": "CAD",
"value": str(App.get_running_app().cart)
}}]})

try:
response = client.execute(request)
print("Order With Complete Payload:")
print("Status Code:", response.status_code)
print("Status:", response.result.status)
print("Order ID:", response.result.id)
print("Intent:", response.result.intent)
print("Links:")
for link in response.result.links:
print('\t{}: {}\tCall Type: {}'.format(link.rel, link.href, link.method))
print("Total Amount: {} {}".format(response.result.purchase_units[0].amount.currency_code,
response.result.purchase_units[0].amount.value))
order = response.result
print(order)
except IOError as ioe:
print(ioe)
if isinstance(ioe, HttpError):
print(ioe.status_code)
webbrowser.open("https://www.sandbox.paypal.com/checkoutnow?token=" + response.result.id)

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.