如何获得paypal customerid(subscriber_id)

时间:2016-12-29 09:06:50

标签: php paypal payment

我正在使用cakephp2.0框架。我正在做定期付款。我没有得到customer_id和其他变量。我还将Recurring发送给Y.

这是我的代码:

$paypalParams = array(
    'paymentAction' => "Sale",
    'amount' => $_POST['amount'],
    'currencyCode' => "USD",
    'creditCardType' => $_POST['card_type'],
    'creditCardNumber' => trim(str_replace(" ","",$_POST['card_number'])),
    'expMonth' => $_POST['expiry_month'],
    'expYear' => $_POST['expiry_year'],
    'cvv' => $_POST['cvv'],
    'firstName' => $firstName,
    'lastName' => $lastName,
    'city' => $city,
    'zip'    => $zipcode,
    'countryCode' => $countryCode,
    'recurring' => 'Y',
    'billingPeriod' => $session_details['paymentType'],
    'billingFrequency' => "1",
    'totalBillingCycles' => "0",
);
echo "<pre>"; print_r($paypalParams);
$response = $paypal->paypalCall($paypalParams);

当我致电paypalCall函数时:

public function paypalCall($params){
    /*
     * Construct the request string that will be sent to PayPal.
     * The variable $nvpstr contains all the variables and is a
     * name value pair string with & as a delimiter
     */
    $recurringStr = (array_key_exists("recurring",$params) && $params['recurring'] == 'Y')?'&RECURRING=Y':'';
    $nvpstr = "&TOTALBILLINGCYCLES=".$params['totalBillingCycles']."&BILLINGFREQUENCY=".$params['billingFrequency']."&BILLINGPERIOD=".$params['billingPeriod']."&PAYMENTACTION=".$params['paymentAction']."&AMT=".$params['amount']."&CREDITCARDTYPE=".$params['creditCardType']."&ACCT=".$params['creditCardNumber']."&EXPDATE=".$params['expMonth'].$params['expYear']."&CVV2=".$params['cvv']."&FIRSTNAME=".$params['firstName']."&LASTNAME=".$params['lastName']."&CITY=".$params['city']."&ZIP=".$params['zip']."&COUNTRYCODE=".$params['countryCode']."&CURRENCYCODE=".$params['currencyCode'].$recurringStr;
    //echo "<pre>"; print_r($nvpstr); die;
    /* Make the API call to PayPal, using API signature.
       The API response is stored in an associative array called $resArray */
    $resArray = $this->hashCall("DoDirectPayment",$nvpstr);
    echo "<pre>"; print_r($resArray); die;
    return $resArray;
}

当我打印此array($resArray)时,它只提供以下参数:

enter code here
<pre>Array
(
[TIMESTAMP] => 2016-12-29T09:05:26Z
[CORRELATIONID] => 42743fa743c6
[ACK] => Success
[VERSION] => 65.1
[BUILD] => 24616352
[AMT] => 19.99
[CURRENCYCODE] => USD
[AVSCODE] => X
[CVV2MATCH] => M
[TRANSACTIONID] => 9A3464215B244930U
)

没有customerid(subscriber_id)

有人能帮助我看看我做错了什么吗?

0 个答案:

没有答案