- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试通过“经典”NVP API 设置 PayPal 快速支付。
尝试使用 cURL 从我的服务器连接到 PayPal-Sandbox,连接停止并在大约 2 分钟后超时。
我正在使用 example call来自文档:
curl -v --insecure https://api-3t.sandbox.paypal.com/nvp -d "USER=platfo_1255077030_biz_api1.gmail.com&PWD=1255077037&SIGNATURE=Abg0gYcQyxQvnf2HDJkKtA-p6pqhA1k-KTYE0Gcy1diujFio4io5Vqjf&METHOD=SetExpressCheckout&VERSION=78&PAYMENTREQUEST_0_PAYMENTACTION=SALE&PAYMENTREQUEST_0_AMT=19&PAYMENTREQUEST_0_CURRENCYCODE=USD&cancelUrl=http://www.yourdomain.com/cancel.html&returnUrl=http://www.yourdomain.com/success.html"
外壳输出为:
* About to connect() to api-3t.sandbox.paypal.com port 443 (#0)
* Trying 173.0.82.83... Connection timed out
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
当我尝试通过 PHP curl
执行此操作时,我没有收到任何错误,只是一个空的资源句柄。
我可以轻松地从我的本地计算机和我可以访问的其他服务器执行请求(并获取正确的数据),所以我猜这是一些服务器端配置错误。不是服务器人员,我有点无能为力。
cURL 已启用并在 phpinfo
中记录以下内容:
libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
openSSL 也已启用。此外,我在尝试连接到 API 的实时版本时遇到了同样的问题。
最佳答案
尝试
$ch = curl_init();
# Merchant Account Credentials
$ppUserID = "User Id Email"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppPass = "User Pass"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppSign = "Paypal Sign"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppAppID = "APP-80W284485P519543T"; //if it is sandbox then app id is always: APP-80W284485P519543T
$paypal_header_options = array();
$paypal_header_options[] = "X-PAYPAL-SECURITY-USERID: $ppUserID";
$paypal_header_options[] = "X-PAYPAL-SECURITY-PASSWORD: $ppPass";
$paypal_header_options[] = "X-PAYPAL-SECURITY-SIGNATURE: $ppSign";
$paypal_header_options[] = "X-PAYPAL-REQUEST-DATA-FORMAT: NV";
$paypal_header_options[] = "X-PAYPAL-RESPONSE-DATA-FORMAT: NV";
$paypal_header_options[] = "X-PAYPAL-APPLICATION-ID: $ppAppID";
$URL = 'https://api-3t.sandbox.paypal.com/nvp'
.'?USER='.$ppUserID
.'&PWD='.$ppPass
.'&SIGNATURE='.$ppSign
.'&METHOD=SetExpressCheckout'
.'&VERSION=93'
.'&RETURNURL=https://localhost/express-checkout-single-product/success.php?success=true'
.'&CANCELURL=https://localhost/express-checkout-single-product/index.php'
.'&PAYMENTREQUEST_0_CURRENCYCODE=USD'
.'&PAYMENTREQUEST_0_AMT=250.00' #The payment amount for the first receiver # Merchant(Primary AC) Account Amount
.'&PAYMENTREQUEST_0_ITEMAMT=225.00' # Merchant(Primary AC) Account Email
.'&PAYMENTREQUEST_0_TAXAMT=25.00' #Receiver designation (there can be only 1 primary receiver)
.'&PAYMENTREQUEST_0_PAYMENTACTION=Order'
.'&PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID=email'
.'&PAYMENTREQUEST_0_PAYMENTREQUESTID=CART110-PAYMENT0' #The payment amount for the second receiver # Seller(Secondry AC) Account Amount
.'&PAYMENTREQUEST_1_CURRENCYCODE=USD'
.'&PAYMENTREQUEST_1_AMT=75.00' #The payment amount for the first receiver # Merchant(Primary AC) Account Amount
.'&PAYMENTREQUEST_1_ITEMAMT=65.00' # Merchant(Primary AC) Account Email
.'&PAYMENTREQUEST_1_TAXAMT=10.00' #Receiver designation (there can be only 1 primary receiver)
.'&PAYMENTREQUEST_1_PAYMENTACTION=Order'
.'&PAYMENTREQUEST_1_SELLERPAYPALACCOUNTID=email'
.'&PAYMENTREQUEST_1_PAYMENTREQUESTID=CART110-PAYMENT1'
.'&L_PAYMENTREQUEST_0_NAME0=Departs2'
.'&L_PAYMENTREQUEST_0_NAME0=Sunset'
.'&L_PAYMENTREQUEST_0_QTY0=1'
.'&L_PAYMENTREQUEST_0_AMT0=125'
.'&L_PAYMENTREQUEST_0_TAXAMT0=15'
.'&L_PAYMENTREQUEST_0_NAME1=Departs'
.'&L_PAYMENTREQUEST_0_QTY1=1'
.'&L_PAYMENTREQUEST_0_AMT1=100.00'
.'&L_PAYMENTREQUEST_0_TAXAMT1=10.00';
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $paypal_header_options);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$paypal_response = curl_exec($ch);
$responseAr = explode('&', $paypal_response);
$parsedResponseAr = array();
foreach($responseAr as $i => $value) {
$tmpAr = explode('=', $value);
if(!empty($tmpAr))
$parsedResponseAr[strtoupper($tmpAr[0])] = urldecode($tmpAr[1]);
}
print_r(json_encode($parsedResponseAr));
curl_close($ch);
关于php - 无法通过 cURL 连接到 PayPal API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15344742/
如果我的交易中的次要收款人没有 Paypal 帐户,会发生什么情况。他会收到要求他创建 Paypal 帐户的通知,还是 API 调用不会成功? 我几乎无法知道销售服务的用户在注册我的平台时是否有Pay
我们知道有这么多的支付网关服务提供商,即 Paypal ,moneybrookers,authorize.net以及许多国内和国际的支付网关提供商。现在,我的问题是,开发我们自己的支付网关服务以处理世
我们正在寻求替代我们对 Authorize.net 的使用。我花了很多时间查看 PayPal 文档,但找不到我的问题的明确答案: 使用 thousand 数十种不同的 PayPal API 可以在我们
我实际上是在为客户工作。我已经在网站上成功实现了 paypal pro,并且一切正常,我相信我遵循了他们的流程和指南,使它按照他们的意思工作。 因此,我一直在阅读 this webpage将网站投入生
我有2件商品要出售。我的运输底价为7.50美元,每增加一个项目,则为2.00美元 我已经设置了高级代码 运费= $ 7.50 运费2 = $ 2.00 一切正常,除非在购物车中添加了其他商品后,购物车
我想在不使用购物车的情况下实现一个不太复杂的解决方案。 我在自己对这个问题的回答中详细说明了解决方案,但如果有人能提出更好的方法,我会很高兴。 谢谢 最佳答案 实际上我最近不得不这样做。毫无疑问,我的
我创建了一个带有默认支付网关的shopify 小商店,即paypal express checkout。 当客户点击 Paypal 结帐按钮时,他们被要求输入他们的信用卡号并输入电子邮件并选择密码以注
一段时间以来,我一直在运行一个网站,该网站通过向 Paypal 网站发送一个 notify_url 来记录 Paypal 交易,并监听该 notify_url。我的监听页面解析从 paypal 发送的
我在网络应用程序中使用 PayPal Subscribe 按钮。我想将订阅开始日期传递给 PayPal,这不会总是今天的日期。 通常情况下,如果没有有效订阅,PayPal 会创建一个从今天开始的订阅。
大家好,我遇到了“立即购买”paypal 按钮这个令人沮丧的问题。 我希望我的客户能够通过 paypal 使用借记卡/信用卡付款,而无需创建 paypal 帐户,同时我希望能够根据产品类型将不同的定价
我想实现 paypal 授权并自动获取付款。我用过 Paypal 标准账户。我已发送带有授权参数的付款请求。
我想在我的 Paypal 沙盒账户中测试批量支付。根据 paypal 文档,它描述了将资金转移到 paypal 帐户的步骤。但我想转账到我客户的银行账户。我该怎么做? 仅供引用:PayPal 文档内容
我正在尝试登录我的沙盒帐户(使用 chrome),但由于 paypal 的新变化我不能。 Paypal 现在要求我登录开发者网站。我愿意。 然后我转到应用程序->沙盒帐户,然后按“sanbox 站点”
我有一个支持 Paypal 付款的 opencart 系统。是否有允许用户(信用卡)付款而无需强制注册 Paypal 帐户的选项。到目前为止,我使用的是 paypal 标准模块。 最佳答案 使用 Pa
我可以使用 Paypal ID 和密码使用 Paypal 详细信息进行付款而无需重定向到 Paypal 网站吗?我想在不离开我的网站的情况下完成所有付款流程。谢谢 最佳答案 您可以使用 PayFlow
当我尝试 https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamicimage 时,图像损坏了. 这是返回的错误信息: “尝试为应用程序构建 prote
我想向我的客户付款,为此我收到了他们的电子邮件,我想验证电子邮件地址是否存在于 paypal 中! 我搜索并找到了我尝试过的支付身份 API,但它只提供了我的我的数据!这是 LINK那个 API。 我
当从用户的 PayPal 账户中扣款时,PayPal 服务器在一定时间内没有响应(超时)。我们决定假设钱确实已经被拿走了,所以我们会退款。但是,如果钱没有从用户账户中扣除会怎样? PayPal返回什么
我有一个网站可以定期(比如每周一次)从客户那里收到钱。我将我的客户详细信息存储在我的数据库中,我想从我的客户帐户中提取资金,而不是每次都提示他们进行身份验证。金额会因客户而异。我怎样才能用 pay p
我有一个表格,其中一个团队签下他们的球员,然后被运送到 Paypal 进行注册付款,然后当一切都完成后我会收到一个 IPN。我正在做一个类似的表格,发现自从我创建该表格以来,Paypal 发生了很大变
我是一名优秀的程序员,十分优秀!