def payment_process(request): order_id = request.session.get("order_id") order = get_object_or_404(Order, id=order_id) host = request.get_host() paypal_dict = { "business": settings.PAYPAL_RECEICER_EMAIL, "ammount": '%.2f' % order.get_total_cost().quantize(Decimal('.01')), "item_name": f"Order {order.id}", "invoice": str(order.id), "currency_code": "EUR", "notify_url": f"http://{host}{reverse('paypal-ipn')}", "return_url": f"http://{host}{reverse('payment:done')}", "cancel_return": f"http://{host}{reverse('payment:canceled')}" } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, "payment/process.html", { "order": order, "form": form })
def process_payment(request): order_id = request.session.get('order_id') order = get_object_or_404(Orders, order_id=order_id) amount = request.POST.get('amount', '') host = request.get_host() paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': amount, 'item_name': 'Order {}'.format(order.order_id), 'invoice': str(order.order_id), 'currency_code': 'INR', 'quantity': 'will display', } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'shop/process_payment.html', { 'order': order, 'form': form })
def view_recharge(self, request): paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "amount": "1.19", "item_name": "Créditos do Efforia", "invoice": "unique-invoice-id", "notify_url": "http://www.efforia.com.br/paypal", "return_url": "http://www.efforia.com.br/", "cancel_return": "http://www.efforia.com.br/cancel", 'currency_code': 'BRL', 'quantity': '1' } payments = PayPalPaymentsForm(initial=paypal_dict) form = CreditForm() return render(request, "recharge.jade", { 'form': payments, 'credit': form }, content_type='text/html')
def get(self, request, **kwargs): # What you want the button to do. job = get_object_or_404(Job, slug=kwargs['slug'], user=request.user) paypal_dict = { "business": settings.BUSINESS_EMAIL, "amount": settings.PREMIUM_PRICE, "item_name": "Premium Job", "invoice": invoice_id_generator(), "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), "return": request.build_absolute_uri(reverse('jobs:detail', args=[kwargs['slug']])), "cancel_return": request.build_absolute_uri(reverse('jobs:detail', args=[kwargs['slug']])), "custom": settings.PREMIUM_PLAN, "job": job.id, } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form} job.save() return self.render_to_response(context)
def payment_process(request, order_id): order = get_object_or_404(Order, id=order_id) host = request.get_host() paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': order.get_total_price(), 'item_name': 'Order {}'.format(order.id), 'invoice': str(order.id), 'currency_code': 'INR', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('payment_done')), 'cancel_return': 'http://{}{}'.format(host, reverse('payment_cancelled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'order/process_payment.html', { 'order': order, 'form': form })
def get_context_data(self, **kwargs): context_data = super().get_context_data(**kwargs) if self.object.currency and self.object.cost and self.object.company.\ company_paypal_account: paypal_dict = { "business": self.object.company.company_paypal_account, "amount": self.object.get_discount_price, "notify_url": self.request.build_absolute_uri(), "return_url": self.request.build_absolute_uri(), "cancel_return": self.request.build_absolute_uri(), "item_number": self.object.pk, "item_name": self.object.name, "no_shipping": 0, "quantity": 1, "currency_code": self.object.currency } context_data['paypal_form'] = PayPalPaymentsForm(initial=paypal_dict) return context_data
def paypal_pay(request): # What you want the button to do. paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, # "password":settings.PAYPAL_API_PASSWORD, # "signature":settings.PAYPAL_API_SIGNATURE, "amount": "100", "item_name": "TNT Listing", "invoice": "unique-invoice-id", "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), "return": request.build_absolute_uri(reverse('done')), "cancel_return": request.build_absolute_uri(reverse('canceled')), # "custom": "premium_plan", # Custom command to correlate to some function later (optional) } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form} return render(request, "home.html", context)
def money_list(request): table = MoneyOwedTable(MoneyOwed.objects.filter(owner=request.user)) RequestConfig(request).configure(table) host = request.get_host() paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': 100, 'item_name': 'Item_Name_xyz', 'invoice': 'Test Payment Invoice', 'currency_code': 'CAD', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('payment_done')), 'cancel_return': 'http://{}{}'.format(host, reverse('payment_canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'iou_template/money_list.html', { 'table': table, 'form': form })
def view_that_asks_for_money(request, id_carritu): carretilla = Carret.objects.get(id=id_carritu) usuari = Usuari.objects.get(usuari=request.user) # What you want the button to do. paypal_dict = { "business": request.user.email, "amount": carretilla.preu_total, "item_name": "name of the item", "invoice": "unique-invoice-id", "notify_url": "https://www.example.com" + reverse('paypal-ipn'), "return_url": "https://www.example.com/your-return-location/", "cancel_return": "https://www.example.com/your-cancel-location/", "custom": "Upgrade all users!", # Custom command to correlate to some function later (optional) } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form, "carretilla": carretilla} return render(request, "payment.html", context)
def payment_process(request): orden_id = request.session.get('orden_id') orden = get_object_or_404(models.Orden, pk=orden_id) host = request.get_host() paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': str(orden.get_total()), 'item_name': 'Orden {}'.format(orden.id), 'invoice': str(orden.id), 'currency_code': 'USD', 'notify_url': 'http://{}{}'.format(host, reverse('paypal:paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('payment:done')), 'cancel_return': 'http://{}{}'.format(host, reverse('payment:canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, "payment/process.html", { "form": form, "orden": orden })
def paypal_pay(request): """ Page where we ask user to pay with paypal. """ paypal_dict = { "business": "*****@*****.**", "amount": "100.00", "currency_code": "RUB", "item_name": "products in socshop", "invoice": "INV-00001", "notify_url": reverse('paypal-ipn'), "return_url": "http://localhost:8000/payment/success/", "cancel_return": "http://localhost:8000/payment/cart/", "custom": str(request.user.id) } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form, "paypal_dict": paypal_dict} return render(request, "payment.html", context)
def payment_process(request): order_id = request.session.get('order_id') order = get_object_or_404(Order, id=order_id) host = request.get_host() paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "amount": '%.2f' % order.get_cart_total(), "item_name": 'Order {}'.format(order.ref_code), "invoice": order.ref_code, "notify_url": 'http://{}{}'.format(host, reverse('paypal-ipn')), "return": 'http://{}{}'.format(host, reverse('payment:done')), "cancel_return": 'http://{}{}'.format(host, reverse('payment:canceled')), "currency_code": "USD", } form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form, 'order': order, 'Shopping': 'active'} return render(request, "payment/process.html", context)
def PaypalForm(inscription): paypal_dict = { "business": settings.PAYPAL_EMAIL, "amount": settings.INSCRIPTION_COST + ".00", "item_name": "ECSL de " + inscription.user.get_full_name(), "invoice": "ecsl_%d" % (inscription.pk, ), "notify_url": settings.PAYPAL_SITE_BASE + reverse('paypal-ipn'), "return_url": settings.PAYPAL_SITE_BASE + reverse("paypal_ap", args=("success",)), "cancel_return": settings.PAYPAL_SITE_BASE + reverse("paypal_ap", args=("wrong",)), # Custom command to correlate to some function later (optional) #"custom": "Upgrade all users!", } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) return form
def payment_process(request): order_id = request.session.get('order_id') order = get_object_or_404(Order, id=order_id) host = request.get_host() paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': '%.2f' % order.get_total_cost().quantize(Decimal('.01')), 'item_name': 'Order {}'.format(order.id), 'invoice': str(order.id), 'currency_code': 'TWD', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('payment:done')), 'cancel_return': 'http://{}{}'.format(host, reverse('payment:canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'payment/process.html', { 'order': order, 'form': form })
def view_that_asks_for_money(request): # What you want the button to do. paypal_dict = { "business": "*****@*****.**", "amount": "1.00", "item_name": "name of the item", "invoice": "unique-invoice-id", "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), "return": request.build_absolute_uri(reverse('your-return-view')), "cancel_return": request.build_absolute_uri(reverse('your-cancel-view')), "custom": "premium_plan", # Custom command to correlate to some function later (optional) } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form} return render(request, "payment.html", context)
def payment_process(request, pk): order = get_object_or_404(Order, pk=pk) host = request.get_host() paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': order.total, 'item_name': 'Order {}'.format(order.topic), 'invoice': str(order.id), 'currency_code': 'USD', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('done')), 'cancel_return': 'http://{}{}'.format(host, reverse('canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'process.html', {'form': form, order: order})
def payment_process(request): cart = check_or_create_cart(request) host = request.get_host() paypal_dict = { 'business': BUSSNESS_EMAIL, 'amount': f'{cart.final_value}', 'item_name': f'Cart {cart.id}', 'invoice': str(cart.id), 'currency_code': 'EUR', 'notify_url': f'http://{host}{reverse("paypal-ipn")}', 'return_url': 'http://{}{}'.format(host, reverse('paypal_done')), 'cancel_return': 'http://{}{}'.format(host, reverse('paypal_canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'paypal_/process.html', { 'order': cart, 'form': form })
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) order = Orders.objects.get(orderid=self.kwargs['pk']) host = self.request.get_host() paypal_dict = { 'business': settings.PERSONAL_RECIEVER_EMAIL, 'amount': order.cost, 'item_name': f'Order {order.orderid}', 'invoice': order.orderid, 'currency_code': 'USD', 'notify_url': f'http://{host}{reverse("paypal-ipn")}', 'return_url': f'http://{host}{reverse("payment-done")}', 'cancel_return': f'http://{host}{reverse("payment-cancelled")}', 'custom': 'premium_plan' } context['form'] = PayPalPaymentsForm(initial=paypal_dict) return context
def payment_process(request): host = request.get_host() all = Cart.objects.filter(cart_user=request.user) total = [] for i in all: total.append(i.total) x = sum(total) paypal_dict = { 'busiess': settings.PAYPAL_RECEIVER_EMAIL, 'amount': '%.2f' % x, 'item_name': all, 'invoice': randint(1, 1000000), 'currency_code': 'USD', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('payment:done')), 'cancel_return': 'http://{}{}'.format(host, reverse('payment:cancelled')) } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'process.html', {'form': form})
def view(request): try: thereturn = HttpResponse( 'You are not authorized to view this area of the website') loggedin, data = ttagServiceAuth(request) if loggedin: usertemplate = 'base_marketing.html' follow = -1 hidebadges = True hidefooter = True hideproinfo = True user_id = data["_id"] angularapp = "ttagitMarketing" paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "custom": user_id, "item_number": request.COOKIES['access_token'], "item_name": "Ttagit Ad Credits", "notify_url": paths.HTTPS + request.get_host() + "/3f2cf0fe3d994fb8dfe6d8f9g2h5", "return_url": paths.HTTPS + request.get_host() + reverse('marketing-thankyou'), "cancel_return": paths.HTTPS + request.get_host() + reverse('marketing'), } form = PayPalPaymentsForm(initial=paypal_dict) formaction = conf.POSTBACK_ENDPOINT if not debug.DEBUG else conf.SANDBOX_POSTBACK_ENDPOINT thereturn = render_to_response( 'marketing_details.html', locals(), context_instance=RequestContext(request)) return thereturn except: logger = logging.getLogger(__name__) return errorscreen(request, logger, sys)
def get_context_data(self, **kwargs): context_data = super().get_context_data(**kwargs) extra_form = create_extra_form(self.object, self.request) if extra_form: if self.request.method == 'POST' and extra_form.is_valid(): extra_form.save() context_data['extra_params_uuid'] = \ extra_form.cleaned_data.get('extra_params_uuid') else: context_data['extra_form'] = extra_form if self.object.currency and self.object.cost: paypal_dict = { "business": self.object.company.company_paypal_account or '', "amount": self.object.get_discount_price, "notify_url": "%s://%s%s" % (self.request.scheme, self.usersite.site.domain, reverse('paypal-ipn')), "return_url": self.request.build_absolute_uri(), "cancel_return": self.request.build_absolute_uri(), "item_number": self.object.pk, "item_name": self.object.name, "no_shipping": 0, "quantity": 1, "currency_code": self.object.currency } context_data['paypal_form'] = PayPalPaymentsForm( initial=paypal_dict) context_data['loop_times'] = range(1, 11) return context_data
def payment_method(request, order_id): if Profile.objects.filter(username=request.user).exists(): user_profile = Profile.objects.get(user=request.user) else: user_profile = None order = get_object_or_404(Order, id=order_id) host = request.get_host() total = order.get_total_cost() stripe.api_key = settings.STRIPE_SECRET_KEY stripe_total = int(total * 100) description = "Online Shop" data_key = settings.STRIPE_PUBLISHABLE_KEY paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': total, 'item_name': 'Order {}'.format(order.id), 'invoice': str(order.id), 'currency_code': 'EUR', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://127.0.0.1:8000/order/payment_made/{}'.format(order.id), 'cancel_return': 'http://{}{}'.format(host, reverse('cancelled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render( request, 'payment/payment.html', { 'form': form, 'order': order, 'data_key': data_key, 'stripe_total': stripe_total, 'description': description, 'user_profile': user_profile })
def payment_process(request, typPremium): #if request.method == 'POST': user = request.user profile = Profile.objects.get(user=request.user) profile.is_premium = True profile.until_premium = timezone.now() #profile.until_premium = timezone.now() + timedelta(days = 30) profile.save() tranzakcja = Tranzakcja(buyer=user, type_of_premium=typPremium) tranzakcja.save() host = request.get_host() premium = Premium.objects.get(id=1) tranzakcja_id = tranzakcja.id tranzakcja = Tranzakcja.objects.get(id=tranzakcja_id) paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "amount": '%.2F' % premium.price_one_month, "item_name": "Premium", "invoice": str(tranzakcja_id), 'currency_code': 'USD', "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), "return_url": request.build_absolute_uri( reverse('payment:done', kwargs={'payment_id': tranzakcja_id})), "cancel_return": request.build_absolute_uri( reverse('payment:canceled', kwargs={'payment_id': tranzakcja_id})), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, "process.html", { 'tranzakcja': tranzakcja, 'form': form })
def payment_process(request, info, email_paypal, amount): """This is procees to payment with Paypal""" paypal_dict = { "business": email_paypal, "amount": amount, "item_name": info.title, "invoice": info.email, "currency_code": "EUR", "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), "return": request.build_absolute_uri(reverse('payment_done')), "cancel_return": request.build_absolute_uri(reverse('payment_canceled')), "custom": "premium_plan", } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {} context['form'] = form context['form_announce'] = AnnounceForm() return render(request, "payment/payment.html", context)
def payment_process(request): order_id = request.session('order_id') u = user_db.product_details.find_one({'shop_id': order_id}) host = request.get_host() paypal_dict = { 'business': "*****@*****.**", 'amount': '%.2f' % u.get_total_cost().quantize(Decimal('.01')), 'item_name': u['ptitle'], 'invoice': str(u['_id']), 'notify_url': 'https://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'https://{}{}'.format(host, reverse('paypal:done')), 'cancel_return': 'https://{}{}'.format(host, reverse('paypal:canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'payment/process.html', { 'form': form, 'order': order })
def payment_process(request): order_id = request.session.get('order_id') order = get_object_or_404(Order, id=order_id) host = request.get_host() paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "amount": '%.2f' % order.get_total_cost(), #.quantize(Decimal('.01')), "item_name": 'Order {}'.format(order.id), "invoice": str(order.id), "currency_code": 'INR', "notify_url": 'http://{}{}'.format(host, reverse('paypal-ipn')), "return": 'http://{}{}'.format(host, reverse('payment_done')), "cancel_return": 'http://{}{}'.format(host, reverse('payment_canceled')), } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form, "order": order} return render(request, "payment/process.html", context)
def pay_now(request, *args, **kwargs): data = args camper_id = data[1]['camper_id'] # What you want the button to do. paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "amount": "1.00", "item_name": "registration for camp", 'currency_code': 'USD', "invoice": camper_id, "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), "return": request.build_absolute_uri(reverse('your-return-view')), "cancel_return": request.build_absolute_uri(reverse('your-cancel-view')), } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form} return render(request, "pay_now.html", context)
def Process_payment(request): order_id = request.session.get('order_id') order = Cart.objects.get(id=order_id) host = request.get_host() # print(f'host = {host}') paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': order.prod_price, 'item_name': order.prod_name, 'invoice': order.id, 'currency_code': 'USD', 'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 'return_url': 'http://{}{}'.format(host, reverse('payment_done')), 'cancel_return': 'http://{}{}'.format(host, reverse('payment_canceled')), } form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'process_payment.html', { 'order': order, 'form': form })
def paypal_pay(request, cart): """ Page where we ask user to pay with paypal. """ curr_cart = Cart.objects.get(id=cart) paypal_dict = { "business": "hikka228-facilitator_api1.bk.ru", "amount": curr_cart.sum_price, "currency_code": "RUB", "item_name": "products", "invoice": cart, "notify_url": reverse('paypal-ipn'), "return_url": "http://localhost:8000/payment/success/" + cart, "cancel_return": "http://localhost:8000/payment/cart/" + cart, "custom": str(request.user) } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) context = {"form": form, "paypal_dict": paypal_dict} return render(request, "payment.html", context)
def payment_products(request): cart = get_or_set_order_session(request) paypal_dict = { "business": "*****@*****.**", "amount": "1", "item_name": "name of the item", "invoice": "unique-invoice-id", "notify_url": request.build_absolute_uri(reverse('paypal-ipn')), # "return": request.build_absolute_uri(reverse('your-return-view')), # "cancel_return": request.build_absolute_uri(reverse('your-cancel-view')), # Custom command to correlate to some function later (optional) "custom": "premium_plan", } # Create the instance. form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'paypalpayment.html', { 'object': cart, "form": form })