Php 取消每月定期付款?

Php 取消每月定期付款?,php,paypal,cakephp-2.0,payment-gateway,payment,Php,Paypal,Cakephp 2.0,Payment Gateway,Payment,我正在使用CakePHP2.0框架。谁能帮我一下我做错了什么我有退订功能 当我在Unsubscribe函数中发送用户id时,它会转到此处的其他条件。我已成功获取用户id。有人能帮我解决我的问题吗 下面是hashcallFunction enter code here public function hashCall($methodName,$nvpStr){ // form header string $nvpheader = $this->nvpHeader();

我正在使用CakePHP2.0框架。谁能帮我一下我做错了什么我有退订功能

当我在Unsubscribe函数中发送用户id时,它会转到此处的其他条件。我已成功获取用户id。有人能帮我解决我的问题吗 下面是hashcallFunction

enter code here
public function hashCall($methodName,$nvpStr){
    // form header string
    $nvpheader = $this->nvpHeader();

    //setting the curl parameters.
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$this->apiEndpoint);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);

    //turning 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);

    //in case of permission APIs send headers as HTTPheders
    if(!empty($this->authToken) && !empty($this->authSignature) && !empty($this->authTimestamp))
     {
        $headers_array[] = "X-PP-AUTHORIZATION: ".$nvpheader;
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_array);
        curl_setopt($ch, CURLOPT_HEADER, false);
    }
    else 
    {
        $nvpStr = $nvpheader.$nvpStr;
    }
    //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
   //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
    if($this->useProxy)
        curl_setopt ($ch, CURLOPT_PROXY, $this->proxyHost.":".$this->proxyPort); 

    //check if version is included in $nvpStr else include the version.
    if(strlen(str_replace('VERSION=', '', strtoupper($nvpStr))) == strlen($nvpStr)) {
        $nvpStr = "&VERSION=" . urlencode($this->version) . $nvpStr;    
    }

    $nvpreq="METHOD=".urlencode($methodName).$nvpStr;
    //setting the nvpreq as POST FIELD to curl
    curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);

    //getting response from server
    $response = curl_exec($ch);

    //convrting NVPResponse to an Associative Array
    $nvpResArray = $this->deformatNVP($response);
    $nvpReqArray = $this->deformatNVP($nvpreq);
    $_SESSION['nvpReqArray']=$nvpReqArray;

    if (curl_errno($ch)) {
        die("CURL send a error during perform operation: ".curl_error($ch));
    } else {
        //closing the curl
        curl_close($ch);
    }

    return $nvpResArray;
}

您在paypal\u single\u payments表中可能没有任何用户id=24且付款类型为“月”的记录。 您还可以尝试调试$\u POST和$userDetails的内容 变量以查看它们是否为空。
我同意SrQ,您应该使用蛋糕的数据结构和$this->request->数据来访问post变量。

您可能在paypal\u single\u payments表中没有任何用户id=24且payment\u type=“Month”的记录。 您还可以尝试调试$\u POST和$userDetails的内容 变量以查看它们是否为空。
我同意SrQ,您应该使用Cake的数据结构和$this->request->data来访问post变量。

在使用框架时,您应该始终尝试使用Cake的结构。对于初学者,您可以通过
$this->request->data['Model']['attribute']
访问数据。你有没有检查(打印)第一次发现的是什么?您是否确认您的
用户id
正确无误?在使用框架时,您应该始终尝试使用cake的结构。对于初学者,您可以通过
$this->request->data['Model']['attribute']
访问数据。你有没有检查(打印)第一次发现的是什么?您是否确认您的
用户id
正确到达了那里?
enter code here
public function hashCall($methodName,$nvpStr){
    // form header string
    $nvpheader = $this->nvpHeader();

    //setting the curl parameters.
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$this->apiEndpoint);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);

    //turning 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);

    //in case of permission APIs send headers as HTTPheders
    if(!empty($this->authToken) && !empty($this->authSignature) && !empty($this->authTimestamp))
     {
        $headers_array[] = "X-PP-AUTHORIZATION: ".$nvpheader;
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_array);
        curl_setopt($ch, CURLOPT_HEADER, false);
    }
    else 
    {
        $nvpStr = $nvpheader.$nvpStr;
    }
    //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
   //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
    if($this->useProxy)
        curl_setopt ($ch, CURLOPT_PROXY, $this->proxyHost.":".$this->proxyPort); 

    //check if version is included in $nvpStr else include the version.
    if(strlen(str_replace('VERSION=', '', strtoupper($nvpStr))) == strlen($nvpStr)) {
        $nvpStr = "&VERSION=" . urlencode($this->version) . $nvpStr;    
    }

    $nvpreq="METHOD=".urlencode($methodName).$nvpStr;
    //setting the nvpreq as POST FIELD to curl
    curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);

    //getting response from server
    $response = curl_exec($ch);

    //convrting NVPResponse to an Associative Array
    $nvpResArray = $this->deformatNVP($response);
    $nvpReqArray = $this->deformatNVP($nvpreq);
    $_SESSION['nvpReqArray']=$nvpReqArray;

    if (curl_errno($ch)) {
        die("CURL send a error during perform operation: ".curl_error($ch));
    } else {
        //closing the curl
        curl_close($ch);
    }

    return $nvpResArray;
}