- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我尝试通过在 PayPal 中提供以下数据来获取 PayPal 的 token :
Array
(
[PAYMENTREQUEST_0_CURRENCYCODE] => EUR
[PAYMENTREQUEST_0_INVNUM] => TLT-GR-1
[RETURNURL] => http://www.mysite.ext/my_app/payment-completed/
[CANCELURL] => http://www.mysite.ext/my_app/payment-canceled/
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[SOLUTIONTYPE] => Sole
[L_PAYMENTREQUEST_0_NAME0] => Product Description
[L_PAYMENTREQUEST_0_AMT0] => 0.38
[L_PAYMENTREQUEST_0_QTY0] => 19.27
[PAYMENTREQUEST_0_AMT] => 7.32
[PAYMENTREQUEST_0_ITEMAMT] => 1
)
这是生成上述数组值的代码:
$data = array();
$data['PAYMENTREQUEST_0_CURRENCYCODE'] = $currencyCode;
$data['PAYMENTREQUEST_0_INVNUM'] = $order->ID;
$data['RETURNURL'] = $returnUrl;
$data['CANCELURL'] = $cancelUrl;
$data['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Sale';
$data['SOLUTIONTYPE'] = 'Sole';
$subtotal = 0;
$tax = 0;
$counter = 0;
foreach($products as $product)
{
if($product->Type == 0) // Production is diretion
{
if($product->NightDuration == 0)
{
$price = round($product->Price , 2);
$qty = round($product->Qty , 2);
$data['L_PAYMENTREQUEST_0_NAME' . $counter] = $product->Title;
$data['L_PAYMENTREQUEST_0_AMT' . $counter] = $price;
$data['L_PAYMENTREQUEST_0_NUMBER' . $counter] = ($counter + 1);
$data['L_PAYMENTREQUEST_0_QTY' . $counter] = $qty;
$data['L_PAYMENTREQUEST_0_TAXAMT' . $counter] = round(($qty * $price) * ($taxPercentage / 100), 2);
$data['L_PAYMENTREQUEST_0_ITEMCATEGORY' . $counter] = 'Digital';
$subtotal += $qty * $price;
$tax += ($qty * $price) * ($taxPercentage / 100);
}
else
{
}
}
else
{
}
$counter++;
}
$data['PAYMENTREQUEST_0_AMT'] = round($subtotal + $tax, 2);
$data['PAYMENTREQUEST_0_ITEMAMT'] = 1;
$data['PAYMENTREQUEST_0_TAXAMT'] = round($tax, 2);
echo "<pre>";
print_r($data);
echo "</pre>";
$data = http_build_query($data, '', '&');
$pp = new TaxiBookingPayPal();
$rt = $pp->PPHttpPost('SetExpressCheckout', $data);
echo "<pre>";
print_r($rt);
echo "</pre>";
我从 PayPal 得到以下结果:
Array
(
[TIMESTAMP] => 2013%2d01%2d19T14%3a44%3a25Z
[CORRELATIONID] => bdfce7f34a1db
[ACK] => Failure
[VERSION] => 94
[BUILD] => 4181146
[L_ERRORCODE0] => 10413
[L_SHORTMESSAGE0] => Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e
[L_LONGMESSAGE0] => The%20totals%20of%20the%20cart%20item%20amounts%20do%20not%20match%20order%20amounts%2e
[L_SEVERITYCODE0] => Error
)
你能看出这段代码有什么问题吗?有没有人可以帮助我?
经过长时间研究我的代码,我发现问题出在我的数字中的小数位上。问题是我不知道小数到底有什么问题:(
谢谢
最佳答案
ITEMAMT + TAXAMT + SHIPPINGAMT + HANDLINGAMT 必须等于 AMT。
ITEMAMT 应该只是项目的小计,但你只在那里传递了 1。
此外,您的数量为 19.27。我从来没有专门测试过他们是否会接受这样的 QTY 值,但即使他们接受,您的 ITEMAMT 也应该是 7.32。
在这种情况下,您没有传递其他值,因此您的 ITEMAMT 和 AMT 将相同。你在那里传递的那个 1 导致了你得到的错误,因为它没有加到你的 AMT 中。
关于php - PayPal 在 SetExpressCheckout 上返回 ACK Failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14415520/
使用普通的 grep 命令,有一个 --exclude 选项(详细介绍如下: Use grep --exclude/--include syntax to not grep through certa
我有 ubuntu 14.04。并使用 ack-grep 2.12 在目录内递归搜索文件中的文本 我想设置 ack-grep 选项 特定于目录 ~/workspace/project/ 这样当我在路径
我们不理解这种 TCP 行为表明 redhat linux 5 TCP 堆栈(HTTP 服务器,这是此转储的来源)收到 SYN 的 ACK,ACK 但继续忽略它并重复重复的 SYN,ACK 5次。最后
我不确定它的用途,但我正在处理的代码有一堆名为“save.d”的文件夹,看起来它们用于某种版本控制(我们也有 . svn 文件夹)。 如何更新我的 .ackrc 文件以默认忽略这些目录? 我的 .ac
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭去年。 Improve th
我已经针对运行在 Ubuntu 14.04.3 LTS (3.13.0-71-generic x86_64) 上的 OpenSSL 1.0.2e 编译了 nginx 1.9.7。我可以毫无问题地使用浏
我有添加新的 ack-grep 文件类型的语法: $ ack-grep --type-add=min=.min.js,.min.css --help types | grep min --[n
我想在任何名为 search-this-one.html 的文件中搜索字符串“my-search-string” 在我当前工作目录的所有子目录中。 我想要包含此字符串的文件的完整路径列表。有数百个名为
我正在使用 ack.pl 工具来搜索文件中的字符串或 IP ack.pl 的官方网站是 - http://beyondgrep.com/documentation/ ack.pl CLI 示例(想在/
如果您正在编写一个基本的 python TCP 服务器和客户端,您需要自己添加 SYN、SYN ACK 和 ACK 响应,还是由套接字模块处理? 如果需要自己写,会这么简单吗? 客户: #set up
[FIN, ACK]、[RST]和[RST, ACK]是什么原因,如何避免? 是否是由于 SO 的 TCP 参数之间存在某种不匹配?服务器在 TCP/IP 连接中回复 [FIN, ACK] 是什么意思
我使用 Vim 插件 ack.vim ,但我不明白为什么命令是带有大写“A”的 :Ack (按住 shift 有点烦人)。 是否可以将其重新映射到 :ack ? 最佳答案 内置命令以小写字符开头,自定
我有一个文件导致 Ack 2.0 报告“权限被拒绝”错误,所以我一直试图让它忽略该文件。 我已经在我的 ackrc 中尝试了以下内容 --type-set=lockfile:match:/NameOf
我有一个文件导致 Ack 2.0 报告“权限被拒绝”错误,所以我一直试图让它忽略该文件。 我已经在我的 ackrc 中尝试了以下内容 --type-set=lockfile:match:/NameOf
我尝试了可能的组合并在互联网上进行了搜索,但无法完成这项工作,错误是: Error: Unexpected ACK received for message-id 如果有人能指出以下代码中是否存在一些
在用 Linux C 编写的 tcp 程序中我想关闭一个 tcp 连接我使用了close(sockfd)我注意到此函数将向另一个对等方发起 FIN/ACK 数据包但是如果另一个对等点由于网络问题或 t
我已经构建了一个 c 函数,该函数应该通过 stomp 库从 ActiveMQ 读取。此代码正在读取收据之前的附加消息(这是我所期望的)。请告知为什么我的 RECEIPT 帧没有在第二个 MESSAG
我正在使用这样的 ack:ack-grep assets\\. (在 Ubuntu 上) 但是,我想排除不以“ Assets ”开头的结果。例如:网站 Assets 。 到目前为止,我已经尝试过 ac
如何使用ack搜索特定文件类型的文件。 例如 ack -f .scss blah acl -f .rb blah 显然上述方法不起作用,但是如何使用ack来做到这一点? 最佳答案 为此使用--type
每次我尝试在ack中添加类型似乎都失败了,即在ack中添加类型(log) ack --type-set log:ext:log ack: No regular expression found. 或者
我是一名优秀的程序员,十分优秀!