Forms 使用Drupal表单和Paypal API对所选计划类型进行单独付款整合
我使用了一个普通的类作为API,因为你正在将所有参数传递给paypal,我获得了成功 我唯一缺少的是金额没有从沙箱帐户中扣除 如果我通过使用Forms 使用Drupal表单和Paypal API对所选计划类型进行单独付款整合,forms,payment,payment-gateway,Forms,Payment,Payment Gateway,我使用了一个普通的类作为API,因为你正在将所有参数传递给paypal,我获得了成功 我唯一缺少的是金额没有从沙箱帐户中扣除 如果我通过使用与贝宝结帐支付购买产品的金额,实际金额将在我的沙箱帐户中扣除 原因可能是什么?有没有其他方法可以让我使用paypal通过payment details表单中传递的参数来接收钱 在drupal表单的submit函数中,我是这样调用的 $paypalDoDirect = new PaypalDoDirect(); // passing all paramete
与贝宝结帐支付购买产品的金额,实际金额将在我的沙箱帐户中扣除
原因可能是什么?有没有其他方法可以让我使用paypal通过payment details表单中传递的参数来接收钱
在drupal表单的submit函数中,我是这样调用的
$paypalDoDirect = new PaypalDoDirect();
// passing all parameters to $paypalDoDirect
$response= $paypalDoDirect->MakePayment();
我得到的交易是成功的,每个参数都得到了成功通过
这是我的类api-
class PaypalDoDirect
{
/**Declared all fields **/
function MakePayment()
{
$API_Endpoint = "https://api-3t.paypal.com/nvp";
if ("sandbox" === $this->environment || "beta-sandbox" === $this->environment) {
$API_Endpoint = "https://api-3t.$this->environment.paypal.com/nvp";
}
// Add request-specific fields to the request string.
$nvpStr = "&PAYMENTACTION=$this->paymentType&AMT=$this->amount&CREDITCARDTYPE=$this->cc_type&ACCT=$this->cc_number" .
"&EXPDATE=$this->expdate_month$this->expdate_year&CVV2=$this->cvv2_number&FIRSTNAME=$this->first_name&LASTNAME=$this->last_name&EMAIL=$this->email" .
"&STREET=$this->address1&CITY=$this->city&STATE=$this->state&ZIP=$this->zip&COUNTRYCODE=$this->country&CURRENCYCODE=$this->currencyID";
//$httpParsedResponseAr = PPHttpPost('DoDirectPayment', $nvpStr);
$methodName_ = 'DoDirectPayment';
$nvpStr_ = $nvpStr;
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// Turn off the server and peer verification (TrustManager Concept).
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.
$nvpreq = "METHOD=$methodName_&VERSION=$this->version&PWD=$this->API_Password&USER=$this->API_UserName&SIGNATURE=$this->API_Signature$nvpStr_";
// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
// Get response from the server.
$httpResponse = curl_exec($ch);
if (!$httpResponse) {
return ("$methodName_ failed: " . curl_error($ch) . '(' . curl_errno($ch) . ')');
}
// Extract the response details.
$httpResponseAr = explode("&", $httpResponse);
$httpParsedResponseAr = array();
foreach ($httpResponseAr as $i => $value) {
$tmpAr = explode("=", $value);
if (sizeof($tmpAr) > 1) {
$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
}
}
if ((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
}
if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
return "success";
} else {
return (urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]));
}
}
}
是的,drupal中有一个模块。这是一个很好的结构化模块,可以在一些自定义模块中扩展paypal IPN
如果您使用此模块,IPN回调将由此模块处理&您可以在您的实例上通过hook\u paypal\u api\u IPN()
获得通知。如果您阅读有关使用paypal处理付款的paypal文档并查看模块代码,您将了解如何很好地使用它。我建议您使用本模块
尽管您可以创建自己的模块来处理贝宝支付,无论是快递用户还是转发用户。很久以前,我用drupal实例做过一次。您必须在给定的URL上为您的帐户发送用户或数据(用于express)以及一些信息&其中发生了什么(通过/失败/终止),paypal将在您提到的实例回调URL处通知您。接收信息并相应地开展工作。这可能就是您要寻找的
执行:
直接支付电话直接向信用卡收费;它不会从PayPal帐户中扣除-即使该卡已附加到现有的PayPal帐户。因此,它不会在我们的“买家”PayPal帐户中显示为交易。我能理解的是,您试图在drupal表单的提交处理程序中调用MakePayment函数,该处理程序包含付款详细信息表单?是的,我就是这么做的。我得到的函数响应是成功的交易,但没有从我的沙箱帐户中扣除任何款项。就好像我用贝宝结账一样,钱从沙箱账户中扣除。我做错了什么?有人用过这样的东西吗?可能是重复的谢谢你的输入。我实际上已经编辑了这个问题。你可以让我知道你对它的想法。对paypalDoDirect类有什么想法以及为什么不扣除金额?@Ram-Nope。我将不得不研究我的旧代码,看看我是如何做的,当我不得不..如果我找到那个实例,我会回复你肯定。。