diff --git a/myproject/myapp/payments.py b/myproject/myapp/payments.py index 3faeffa33b2948cd53b634e3e9fb2d0138ade5ff..8a0e543c19f36c1327352dd859ebbffd1d1517d5 100644 --- a/myproject/myapp/payments.py +++ b/myproject/myapp/payments.py @@ -42,6 +42,7 @@ def create_payment(request): }] }) +<<<<<<< HEAD # Successfully communicated with API if payment.create(): print("Payment created successfully!") @@ -99,4 +100,19 @@ def payment_cancelled(request): return render(request, 'payment_cancelled.html') def payment_success(request): - return render(request,'payment_success.html') \ No newline at end of file + return render(request,'payment_success.html') +======= + if payment.create(): + print("Payment created successfully!") + for link in payment.links: + if link.rel == "approval_url": + approval_url = str(link.href) + print("Redirect for approval: %s" % (approval_url)) + return JsonResponse({"approval_url": approval_url}) + else: + print(payment.error) + return JsonResponse({"error": "Payment creation failed"}) + +def execute_payment(request): + pass +>>>>>>> d6d607c (Add create_payment)