gpt4 book ai didi

php - Paypal自适应支付迷你浏览器

转载 作者:太空宇宙 更新时间:2023-11-03 16:01:03 24 4
gpt4 key购买 nike

我正在尝试通过使用 PHP 中的 Codeigniter 框架的迷你浏览器选项为我的产品使用 Paypal 自适应支付。当我点击支付按钮时,迷你浏览器打开得很好,但是当我点击登录按钮时,新选项卡打开,但我想在现有的迷你浏览器中打开这个登录。

查看文件:

       <html>
<head>
<script src="https://www.paypalobjects.com/js/external/apdg.js" type="text/javascript"></script>
</head>
<body>
<?php echo form_open_multipart('pay/splitPay','target="PPDGFrame"', 'class="standard"', 'id="mini-form"'); ?>
<label for="buy">Buy Now:</label>
<input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif">
<input id="type" type="hidden" name="expType" value="mini">
<input id="paykey" type="hidden" name="paykey" value="10">
</form>
<script type="text/javascript" charset="utf-8">
var returnFromPayPal = function(){

alert("Returned from PayPal");
// Here you would need to pass on the payKey to your server side handle to call the PaymentDetails API to make sure Payment has been successful or not
// based on the payment status- redirect to your success or cancel/failed urls
}
var dgFlowMini = new PAYPAL.apps.DGFlowMini({trigger: 'submitBtn', expType: 'mini', callbackFunction: 'returnFromPayPal'});
</script>

Controller :

     function splitPay() {
$createPacket = array (
"actionType" => "PAY",
"currencyCode" => 'USD',
"receiverList" => array(
"receiver" => array(
array("amount"=>'2.00', "email"=>'bhomnath@salyani.com.np'),
array("amount"=>'4.00', "email"=>'infotechnab_api1@yahoo.com'),
)
),
"returnUrl" => 'http://localhost/paypal/index.php/pay/notify_payment',
"cancelUrl" => 'http://localhost/paypal/index.php/pay/tempo',
"requestEnvelope" => $this->envelope
);

$response = $this->_paypalSend($createPacket,"Pay");
$payKey = $response['payKey'];
$detailsPacket = array(
"requestEnvelope" => $this->envelope,
"payKey" => $payKey,
"receiverOptions" => array(
array(
"receiver"=>array(
'email'=>'bhomnath@salyani.com.np'),
'invoiceData'=>array(
'item'=>array(
array(
"name"=>'product1',
"price"=>'1.00',
"identifier"=>'P1'
),
array(
"name"=>'product2',
"price"=>'1.00',
"identifier"=>'P2'
)
)
)),
array(
"receiver"=>array(
'email'=>'infotechnab_api1@yahoo.com'),
'invoiceData'=>array(
'item'=>array(
array(
"name"=>'product3',
"price"=>'2.00',
"identifier"=>'P1'
),
array(
"name"=>'product4',
"price"=>'2.00',
"identifier"=>'P2'
)
)
))
)
);

$response = $this->_paypalSend($detailsPacket,"SetPaymentOptions");

$dets = $this->getPaymentOptions($payKey);

header("Location: ".$this->paypalUrl.$payKey);
}

最佳答案

PayPal 的安全要求在某些情况下会强制打开一个新窗口(并且 javascript 会强制执行此操作)。通常,当用户输入登录凭据时,他们需要这样做,这可能是您在问题中使用“登录”与“付款”按钮所指的内容?

这样做是为了最大限度地减少通过跨站点脚本攻击窃取凭据的风险,并确保用户看到“chrome”(例如安全连接符号和 PayPal URL),并且可以在输入他们的时验证窗口是否安全连接到 PayPal凭据(出于反网络钓鱼的原因)。

一些较新的 PayPal 产品放宽了这些要求,但我相当肯定 Adaptive 坚定地遵循这种范式。

关于php - Paypal自适应支付迷你浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28104037/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com