def get(self, request, id, *args, **kwargs): booking = Booking.objects.get(pk=id) liq_pay = LiqPay(settings.LIQPAY_PUBLIC_KEY, settings.LIQPAY_PRIVATE_KEY) params = { 'action': 'pay', 'amount': booking.price, 'currency': 'UAH', 'description': 'Оплата за проживання {}'.format(booking.pib), 'order_id': booking.id, 'version': '3', 'sandbox': 1, # sandbox mode, set to 1 to enable it 'server_url': 'http://127.0.0.1:8000/pay-callback/{}'.format( booking.id), # url to callback view } signature = liq_pay.cnb_signature(params) data = liq_pay.cnb_data(params) return render(request, self.template_name, { 'signature': signature, 'data': data })
def get(self, request, *args, **kwargs): liqpay = LiqPay(settings.LIQPAY_PUBLIC_KEY, settings.LIQPAY_PRIVATE_KEY) params = { 'action': 'pay', 'amount': '1', 'currency': 'USD', 'description': 'Payment for clothes', 'order_id': 'order_id_12', 'version': '3', 'sandbox': 0, # sandbox mode, set to 1 to enable it 'server_url': 'http://127.0.0.1:8000/pay-callback/', # url to callback view } signature = liqpay.cnb_signature(params) data = liqpay.cnb_data(params) return render(request, self.template_name, { 'signature': signature, 'data': data })