- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 PayPal 退款支付网关。我的主要目标是向用户退还金额,同时我必须向另一个用户支付一定金额。在这里,我作为管理员,假设我有 150 美元通过 PayPal 记入我的账户。我有它的交易 ID。现在我需要返回假设 100 美元给用户 1,我需要发送 20 美元给用户 2。
<?php
/**
*
*
* This PayPal API provides the functionality of Refunding Amount.
* Credentials are omitted from here for privacy purpose. To use it credentials are compulsory to provide.
*/
class PayPalRefund
{
private $API_Username, $API_Password, $Signature, $API_Endpoint, $version;
function __construct($mode = "sandbox")
{
if($mode == "live")
{
$this->API_Username = "sample@gmail.com";
$this->API_Password = "137301275897";
$this->Signature = "AoNBG1CB1212IgLS5QaKlVpODjsaTncPABthzh5N-Nzz511tOodumbgF0TvVDq";
$this->API_Endpoint = "https://api-3t.paypal.com/nvp";
}
else
{
$this->API_Username = "sample@gmail.com";
$this->API_Password = "137301275897";
$this->Signature = "AoNBG1CB1212IgLS5QaKlVpODjsaTncPABthzh5N-Nzz5t11OodumbgF0TvVDq";
$this->API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
}
$this->version = "51.0";
}
/**
* This function actually Sends the CURL Request for Refund
* @param string - $requestString
* @return array - returns the response
*/
function sendRefundRequest($requestString)
{
$this->API_UserName = urlencode($this->API_Username);
$this->API_Password = urlencode($this->API_Password);
$this->API_Signature = urlencode($this->Signature);
$this->version = urlencode($this->version);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
// Set the API operation, version, and API signature in the request.
$reqStr = "METHOD=RefundTransaction&VERSION={$this->version}&PWD={$this->API_Password}&USER={$this->API_UserName}&SIGNATURE={$this->API_Signature}$requestString";
// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $reqStr);
// Get response from the server.
$curlResponse = curl_exec($ch);
if(!$curlResponse)
return array("ERROR_MESSAGE"=>"RefundTransaction failed".curl_error($ch)."(".curl_errno($ch).")");
// Extract the response details.
$httpResponseAr = explode("&", $curlResponse);
$aryResponse = array();
foreach ($httpResponseAr as $i => $value)
{
$tmpAr = explode("=", $value);
if(sizeof($tmpAr) > 1)
{
$aryResponse[$tmpAr[0]] = urldecode($tmpAr[1]);
}
}
if((0 == sizeof($aryResponse)) || !array_key_exists('ACK', $aryResponse))
return array("ERROR_MESSAGE"=>"Invalid HTTP Response for POST request ($reqStr) to {$this->API_Endpoint}");
return $aryResponse;
}
/**
* @param array $aryData
* @return array
*/
function refundAmount($aryData)
{
if(trim(@$aryData['currencyCode'])=="")
return array("ERROR_MESSAGE"=>"Currency Code is Missing");
if(trim(@$aryData['refundType'])=="")
return array("ERROR_MESSAGE"=>"Refund Type is Missing");
if(trim(@$aryData['transactionID'])=="")
return array("ERROR_MESSAGE"=>"Transaction ID is Missing");
$requestString = "&TRANSACTIONID={$aryData['transactionID']}&REFUNDTYPE={$aryData['refundType']}&CURRENCYCODE={$aryData['currencyCode']}";
if(trim(@$aryData['invoiceID'])!="")
$requestString = "&INVOICEID={$aryData['invoiceID']}";
if(isset($aryData['memo']))
$requestString .= "&NOTE={$aryData['memo']}";
if(strcasecmp($aryData['refundType'], 'Partial') == 0)
{
if(!isset($aryData['amount']))
{
return array("ERROR_MESSAGE"=>"For Partial Refund - It is essential to mention Amount");
}
else
{
$requestString = $requestString."&AMT={$aryData['amount']}";
}
if(!isset($aryData['memo']))
{
return array("ERROR_MESSAGE"=>"For Partial Refund - It is essential to enter text for Memo");
}
}
$resCurl = $this->sendRefundRequest($requestString);
return $resCurl;
}
}
?>
和
/**
*
*
* This PayPal API provides the functionality of Refunding Amount.
* Credentials are omitted from here for privacy purpose. To use it credentials are compulsory to provide.
*/
/*
* Currency Types
* ('USD', 'GBP', 'EUR', 'JPY', 'CAD', 'AUD')
*
* Refund Type
* ('Partial', 'Full')
*
* Transaction ID
* We can get the Transaction ID from IPN Response
*/
/*
* Partial Refund
*/
$aryData['transactionID'] = "7H123X43620BH3959058";
$aryData['refundType'] = "Partial"; //Partial or Full
$aryData['currencyCode'] = "USD";
$aryData['amount'] = 2.00;
$aryData['memo'] = "There Memo Detail entered for Partial Refund";
// $aryData['invoiceID'] = "xxxxxxxxxx";
//echo "<pre>";
//print_r($aryData);die;
$ref = new PayPalRefund("sandbox");
$aryRes = $ref->refundAmount($aryData);
if($aryRes['ACK'] == "Success")
echo "Amount Refunded Successfully";
else
echo "Error Refunding Amount";
echo "<pre>";
print_r($aryRes);
echo "</pre>";
?>
我收到错误的退款金额:
Error Refunding Amount
Array
(
[TIMESTAMP] => 2014-05-23T07:13:21Z
[CORRELATIONID] => f42e83df6f52b
[ACK] => Failure
[VERSION] => 51.0
[BUILD] => 11110362
[L_ERRORCODE0] => 10007
[L_SHORTMESSAGE0] => Permission denied
[L_LONGMESSAGE0] => You do not have permission to refund this transaction
[L_SEVERITYCODE0] => Error
)
最佳答案
关于php - Paypal 退款交易问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23823553/
如果我的交易中的次要收款人没有 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 发生了很大变
我是一名优秀的程序员,十分优秀!