public static function getPayForm($zakaz) { $liqp = array('amount' => $zakaz->sum, 'currency' => 'UAH', 'description' => 'Оплата почтовых услуг', 'order_id' => 'order_' . $zakaz->id, 'language' => 'en', 'result_url' => 'http://vkonverte.com.ua/?action=saveLiqPay&id=' . $zakaz->id, 'type' => 'buy'); $public_key = "i2585333566"; $private_key = "11gIelq1UB7amSrjYz7SsA1dFcyRq9ji5GJnPpHo"; $liqpay = new LiqPay($public_key, $private_key); return $liqpay->cnb_form($liqp); }
/** * @Security("has_role('ROLE_USER')") * @Route("/pay/add/{adv_id}", name="get-pay-form", options={"expose"=true}) * @param Request $request * @param integer $adv_id * @return JsonResponse */ public function payAction(Request $request, $adv_id) { $data = (object) json_decode($request->getContent(), true); /** @var User $user */ $user = $this->getUser(); /** @var EntityManager $em */ $em = $this->getDoctrine()->getManager(); $user = $em->getReference('NaidusvoeBundle:User', $user->getId()); $adv = $em->find('NaidusvoeBundle:Advertisment', $adv_id); $order = new Order($user, $adv); $hash = Order::generateHash($em, $user->getId(), $adv_id); $result = Order::CheckForm($data, $order); if ($result['correct'] === true) { /** @var Order $order */ $order = $result['order']; $order->setHash($hash); $order->setStatus('new'); $em->persist($order); $em->flush(); $liqpay = new \LiqPay($this->public_key, $this->private_key); $html = $liqpay->cnb_form(array('version' => '3', 'amount' => $order->getAmount(), 'currency' => 'UAH', 'description' => 'Оплата додаткових послуг для сайту ZnaiduSvoe.com', 'order_id' => $hash, 'sandbox' => 1, 'pay_way' => $order->getPayWay(), 'server_url' => $this->generateUrl('confirm-payment-callback', ['hash' => $hash], UrlGeneratorInterface::ABSOLUTE_URL), 'result_url' => $this->generateUrl('advertisement-page', ['type' => $adv->getType()->getSlug(), 'adv_id' => $adv->getId()], UrlGeneratorInterface::ABSOLUTE_URL))); return new JsonResponse(['status' => 'ok', 'form' => $html]); } else { return new JsonResponse(['status' => 'error', 'message' => 'PAYMENT_INCORRECT_DATA']); } }
public function __construct($context) { parent::__construct(); $this->context = $context; $public_key = "i2585333566"; $private_key = "11gIelq1UB7amSrjYz7SsA1dFcyRq9ji5GJnPpHo"; $tovar = array('amount' => '6', 'currency' => 'UAH', 'description' => 'Оплата почтовых услуг', 'order_id' => 'order_' . date('YmdHi', time()), 'type' => 'buy'); $liqpay = new LiqPay($public_key, $private_key); $form = $liqpay->cnb_form($tovar); $sign = $liqpay->cnb_signature($tovar); $this->context->payform = $form; $this->context->signature = $sign; $this->runame = get_class($this); }
function view($postId) { $this->view->canon = 'payment'; $this->view->titl = 'Select payment method'; $this->view->post = $this->model->singlePost($postId); $micro = sprintf("%06d", (microtime(true) - floor(microtime(true))) * 1000000); // Ну раз что-то нужно добавить для полной уникализации то .. $number = date("YmdHis"); //Все вместе будет первой частью номера ордера $order_id = $number . $micro; //Будем формировать номер ордера таким образом... $merchant_id = 'i71658652626'; //Вписывайте сюда свой мерчант $signature = "NdIKOaHg7r1TulEe82hIzrmt8UqqYnuYtXUdXDnt"; //Сюда вносите public_key //$desc = $_GET['desc']; //Можно так принять назначение платежа //$order_id = $_GET['order_id']; //Можно так принять назначение платежа $price = $this->view->post[0]['price']; //Все что нужно скрипту - передать в него сумму (вы можете передавать все, вплоть до ордера и описания ...) $postToPay = $this->view->post[0]['postid']; $liqpay = new LiqPay($merchant_id, $signature); $html = $liqpay->cnb_form(array('version' => '3', 'amount' => "{$price}", 'currency' => 'USD', 'description' => "Post №{$postToPay}", 'order_id' => $order_id, 'language' => 'en', 'server_url' => 'http://dotnetnow.com/thanks/callback', 'result_url' => 'http://dotnetnow.com/thanks/success')); $this->view->htm = $html; $this->view->render('payment/index', TRUE); }
public function process($template = null) { $order = $this->order; $order->order(); $order->setPaymentStatus('initialized'); // Ставим заказу статус "инициализирована оплата" // Загружаем API класс LiqPay objectProxyHelper::includeClass('emarket/classes/payment/api/', 'LiqPay'); $liqpay = new LiqPay($this->getValue('public_key'), $this->getValue('private_key')); $sandbox_status = 0; if ($this->getValue('sandbox_status')) { $sandbox_status = 1; } $domain = $_SERVER['HTTP_HOST']; $html = $liqpay->cnb_form(array('version' => '3', 'sandbox' => $sandbox_status, 'amount' => $order->getActualPrice(), 'currency' => $this->getValue('currency'), 'description' => $this->getValue('desc'), 'pay_way' => $this->getValue('pay_way'), 'order_id' => $order->getId(), 'type' => 'buy', 'result_url' => $domain . '/emarket/purchase/result/successful/?order_id=' . $order->getId() . '&order_type=liq_pay')); $param = array(); $param['form_html'] = $html; list($templateString) = def_module::loadTemplates("emarket/payment/liqpay/" . $template, "form_block"); return def_module::parseTemplate($templateString, $param); }
</div> <div class="form-group {{ $errors->has('client_id') ? 'has-error' : false }}"> {!! Form::text('product', '', ['class' => 'form-control', 'id' => 'product', 'placeholder' => 'Введите название']) !!} {!! Form::hidden('status_id', '', ['id' => 'status_id']) !!} <div class='products'> <table class="table table-striped"> </table> </div> </div> <?php $public_key = "34567898765"; $private_key = "23456789876"; $liqpay = new LiqPay($public_key, $private_key); $html = $liqpay->cnb_form(array('version' => '1.0', 'amount' => '1', 'currency' => 'RUB', 'description' => 'description text', 'order_id' => '32', 'type' => 'buy')); echo $html; $liqpay = new LiqPay($public_key, $private_key); $html = $liqpay->cnb_signature(array('version' => '1.0', 'amount' => '1', 'currency' => 'USD', 'description' => 'description text', 'order_id' => 32, 'type' => 'buy')); echo $html; ?> <!-- {!!Form::open(['url' => 'https://www.liqpay.com/api/pay'])!!} <input type="hidden" name="_token" value="{{ csrf_token() }}"> {!! Form::hidden('public_key', 'igregreg') !!} {!! Form::hidden('amount', '5') !!} {!! Form::hidden('currency', 'USD') !!} {!! Form::hidden('description', 'Мой товар') !!} {!! Form::hidden('order_id', '123456') !!}
die; } $amount = $request->totalPrice->sum; try { $db = new Database(); $db->beginTransaction(); $response = $db->insertClient($request->textMessage, $request->phoneNumber, $amount, json_encode($request)); if (!$response['state']) { die('Server error. Please contact to administrator.'); } if ($request->paymentMethod == 'onlinePayment') { // online paid $publicKey = $params['liqpay']['publicKey']; $privateKey = $params['liqpay']['privateKey']; $lp = new LiqPay($publicKey, $privateKey); $url = $lp->cnb_form(array('version' => '3', 'amount' => $amount, 'currency' => 'UAH', 'description' => 'payment for order ' . $response['id'] . ' for burgerjoint.com.ua', 'server_url' => "http://{$_SERVER['HTTP_HOST']}/scripts/server.php", 'result_url' => "http://{$_SERVER['HTTP_HOST']}/scripts/result.php?id={$response['id']}", 'order_id' => $response['id'])); } else { $sms = new SmsClient($params['SmsUkraine']['login'], $params['SmsUkraine']['password']); $email = new Email(); if ($email->sendEmail($request, true, $response['id'])) { $db->setAsPaid($response['id']); $sms->sendSMS('BurgerJoint', $params['adminNumber'], 'Нове замовлення ' . $response['id']); $url = 'http://' . $_SERVER['HTTP_HOST'] . '/index.html#/success'; } else { $url = 'http://' . $_SERVER['HTTP_HOST'] . '/index.html#/failure'; } } $db->commit(); echo $url; die; } catch (Exception $e) {
/** * Created by PhpStorm. * User: zvorskyi * Date: 01.12.2015 * Time: 12:16 */ if (isset($_POST['Mode'])) { $public_key = "i22615008395"; $private_key = "wPd44vyFAeu8BzJwxnhehkJeB6Viwj6Z7SdLcOOS"; $curr_date = getdate(); $reg_day = $curr_date["mday"]; $reg_hour = $curr_date["hours"]; $reg_min = $curr_date["minutes"]; $reg_sec = $curr_date["seconds"]; $order_id = "order#" . $reg_day . $reg_hour . $reg_min . $reg_sec; if ($_POST['Mode'] == "350h") { $description = "Оплата тренинга"; $amount = 350; } elseif ($_POST['Mode'] == "500h") { $description = "Оплата тренинга"; $amount = 500; } else { $description = "Предоплата тренинга"; $amount = 100; } require_once "Liquid.php"; $liqpay = new LiqPay($public_key, $private_key); $html = $liqpay->cnb_form(array('version' => '3', 'amount' => $amount, 'currency' => 'UAH', 'description' => $description, 'order_id' => $order_id, 'type' => 'buy', 'language' => 'uk')); echo json_encode($html); }
/** * Display the payment form * @param $queuedPaymentId int * @param $queuedPayment QueuedPayment * @param $request PKPRequest */ function displayPaymentForm($queuedPaymentId, &$queuedPayment, &$request) { if (!$this->isConfigured()) { return false; } AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON); $journal =& $request->getJournal(); $user =& $request->getUser(); $assocId = $queuedPayment->getAssocId(); $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($assocId); $docObj = new Filetotext($authorSubmission->getSubmissionFile()->getFilePath()); $text = $docObj->convertToText(); $amount = mb_strlen($text) / 1000 * $queuedPayment->getAmount(); $liqpay = new LiqPay($this->getSetting($journal->getId(), 'liqpaypubkey'), $this->getSetting($journal->getId(), 'liqpayprivatkey')); if ($this->getSetting($journal->getId(), 'liqpaydebug')) { $debug = 1; } else { $debug = 0; } $html = $liqpay->cnb_form(array('version' => '3', 'amount' => $amount, 'currency' => $queuedPayment->getCurrencyCode(), 'description' => 'Payment for article ' . $assocId . '/' . $queuedPaymentId, 'order_id' => $assocId, 'result_url' => $queuedPayment->getRequestUrl(), 'sandbox' => $debug, 'server_url' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'notification')))); var_dump($request->url(null, 'payment', 'plugin', array($this->getName(), 'notification'))); $params = array('charset' => Config::getVar('i18n', 'client_charset'), 'item_name' => $queuedPayment->getName(), 'item_description' => $queuedPayment->getDescription(), 'amount' => sprintf('%.2F', $amount), 'lc' => String::substr(AppLocale::getLocale(), 3), 'custom' => $queuedPaymentId, 'return' => $queuedPayment->getRequestUrl(), 'cancel_return' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'cancel'))); // $params = array( // 'charset' => Config::getVar('i18n', 'client_charset'), // 'business' => $this->getSetting($journal->getId(), 'selleraccount'), // 'item_name' => $queuedPayment->getName(), // 'item_description' => $queuedPayment->getDescription(), // not a paypal parameter (PayPal uses item_name) // 'amount' => sprintf('%.2F', $queuedPayment->getAmount()), // 'quantity' => 1, // 'no_note' => 1, // 'no_shipping' => 1, // 'currency_code' => $queuedPayment->getCurrencyCode(), // 'lc' => String::substr(AppLocale::getLocale(), 3), // 'custom' => $queuedPaymentId, // 'notify_url' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'ipn')), // 'return' => $queuedPayment->getRequestUrl(), // 'cancel_return' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'cancel')), // 'first_name' => ($user)?$user->getFirstName():'', // 'last_name' => ($user)?$user->getLastname():'', // 'item_number' => $queuedPayment->getAssocId(), // 'cmd' => '_xclick' // ); AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('params', $params); $templateMgr->assign('formliqpay', $html); $templateMgr->assign('liqpayFormUrl', $this->getSetting($journal->getId(), 'liqpayurl')); $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl'); return true; }