def process_payment(request):
price = request.session.get('price')
host = request.get_host()
paypal_dict = {
"cmd": "_xclick-subscriptions",
"business": 'receiver_email@example.com',
"a3": "9.99", # monthly price
"p3": 1, # duration of each unit (depends on unit)
"t3": "M", # duration unit ("M for Month")
"src": "1", # make payments recur
"sra": "1", # reattempt payment on payment error
"no_note": "1", # remove extra notes (optional)
"item_name": "my cool subscription",
'currency_code': 'USD',
'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')),
'return_url': 'http://{}{}'.format(host, reverse('source:payment_done')),
'cancel_return': 'http://{}{}'.format(host, reverse('source:payment_cancelled')),
}
form = PayPalPaymentsForm(initial=paypal_dict)
# Output the button.
form.render()
return render(request, 'Prayer/process_payment.html', {'form': form})