php - 用于争议/拒付的 PayPal IPN
问题描述
因此,我正在使用 PayPal IPN 为我的商店项目中的支付网关。用户可以创建商店并添加一个仅存储其 PayPal 电子邮件的贝宝网关。
我如何收听该付款的退款,以便我可以采取行动。请注意,我显然无权访问这些贝宝账户,因此我无法在他们的贝宝中设置监听器。
当我创建付款时,我正在构建一个查询,然后将它们发送到该 URL,在该查询中是 notify_url,如果有人要对付款产生争议,它将再次使用。我试图引起争议,但是我的数据库似乎没有发生任何事情(通知网址的作用)。
任何帮助都会很棒。这是我正在使用的 codeigniter 库:
[代码] 类贝宝 {
var $config = Array();
var $production_url = 'https://www.paypal.com/cgi-bin/webscr?';
var $sandbox_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?';
var $item = 1;
/**
* Constructor
*
* @param string
* @return void
*/
public function __construct($props = array())
{
$this->__initialize($props);
log_message('debug', "Paypal Class Initialized");
}
// --------------------------------------------------------------------
/**
* initialize Paypal preferences
*
* @access public
* @param array
* @return bool
*/
function __initialize($props = array())
{
$config["business"] = ''; //Your PayPal account
$config["cmd"] = '_cart'; //Do not modify
$config["production"] = FALSE;
#Custom variable here we send the billing code-->
$config["custom"] = '';
$config["invoice"] = '';
#API Configuration-->
$config["upload"] = '1'; //Do not modify
$config["currency_code"] = 'GBP';
$config["disp_tot"] = 'Y';
#Page Layout -->
$config["cpp_header_image"] = ''; //Image header url [750 pixels wide by 90 pixels high]
$config["cpp_cart_border_color"] = '000'; //The HTML hex code for your principal identifying color
$config["no_note"] = 1; //[0,1] 0 show, 1 hide
#Payment Page Information -->
$config["return"] = ''; //The URL to which PayPal redirects buyers’ browser after they complete their payments.
$config["cancel_return"] = ''; //Specify a URL on your website that displays a “Payment Canceled” page.
$config["notify_url"] = ''; //The URL to which PayPal posts information about the payment
$config["rm"] = '2'; //Leave this to get payment information
$config["lc"] = 'EN'; //Languaje [EN,ES]
#Shipping and Misc Information -->
$config["shipping"] = '';
$config["shipping2"] = '';
$config["handling"] = '';
$config["tax"] = '';
$config["discount_amount_cart"] = ''; //Discount amount [9.99]
$config["discount_rate_cart"] = ''; //Discount percentage [15]
#Customer Information -->
$config["first_name"] = '';
$config["last_name"] = '';
$config["address1"] = '';
$config["address2"] = '';
$config["city"] = '';
$config["state"] = '';
$config["zip"] = '';
$config["email"] = '';
$config["night_phone_a"] = '';
$config["night_phone_b"] = '';
$config["night_phone_c"] = '';
/*
* Convert array elements into class variables
*/
if (count($props) > 0)
{
foreach ($props as $key => $val)
{
$config[$key] = $val;
}
}
$this->config = $config;
}
// --------------------------------------------------------------------
/**
* Perform payment process
*
* @access public
* @param array
* @return void
*/
function pay(){
#Convert the array to url encode variables
$vars = http_build_query($this->config);
if($this->config['production'] == TRUE){
header('LOCATION:'.$this->production_url.$vars);
}else{
header('LOCATION:'.$this->sandbox_url.$vars);
}
}
// --------------------------------------------------------------------
/**
* Add a product to the list
*
* @access public
* @param array
* @return void
*/
function add($item_name = '',$item_amount = NULL,$item_qty = NULL,$item_number = NULL){
$this->config['item_name_'.$this->item] = $item_name;
$this->config['amount_'.$this->item] = $item_amount;
$this->config['quantity_'.$this->item] = $item_qty;
$this->config['item_number_'.$this->item] = $item_number;
$this->item++;
}
} // 结束 Paypal 类
/* Paypal.php 文件结束//位置:./application/libraries/Paypal.php */
[/代码]
解决方案
推荐阅读
- c# - 证书安装 (Linux)
- f# - 从 Visual Studio 中查找所有引用被 F# 成员破坏
- javascript - 居中对齐图例文本和圆圈
- webpack - 包含外部 ES6 库时,ExtJs 测试/生产构建失败
- symfony5 - 找不到路线
- django-views - django 形式的馈送数据未传递到数据库或从数据库中检索
- javascript - 数据绑定返回带有数据绑定的 html a href
- flutter - 我正在使用 showGeneralDialog 我需要根据对话框内的布尔值重新渲染按钮
- ios - CoreTelephony 在多平台项目中的使用
- r - 正则表达式:如何将 .* 限制为仅数字和标点符号