【问题标题】:GetRecurringPaymentsProfileDetails API Operation (NVP)GetRecurringPaymentsProfileDetails API 操作 (NVP)
【发布时间】:2016-03-14 21:26:53
【问题描述】:

我想在沙盒 paypal 中获取所有内容...现在,我该如何编码???请帮帮我!谢谢。
这是回应:

[PROFILEID] => I-CL7Kxxx
[STATUS] => 活动
[AUTOBILLOUTAMT] => AddToNextBilling
[DESC] => xxx
[MAXFAILEDPAYMENTS] => 2
[SUBSCRIBERNAME] => Dan
[PROFILESTARTDATE] => 2013-05-15T07:00:00Z
[PROFILEREFERENCE] => 31571
[NEXTBILLINGDATE] => 2013-05-16T10:00:00Z
[ NUMCYCLESCOMPLETED] => 1
[NUMCYCLESREMAINING] => 18446744073709551615
[OUTSTANDINGBALANCE] => 0.00
[FAILEDPAYMENTCOUNT] => 0
[LASTPAYMENTDATE] => 2013-05-15T14:52:04Z[LASTPAYMENTAMT] => 0.10
[TRIALAMTPAID] => 0.00
[REGULARAMTPAID] => 0.10
[AGGREGATEAMT] => 0.10
[AGGREGATEOPTIONALAMT] => 0.00
[FINALPAYMENTDUEDATE] => 1970-01-01T00:00:00Z
[TIMESTAMP] => 2013-05-15T14:55:58Z
[CORRELATIONID] => 225681xxx
[ACK] => 成功
[ VERSION] => 64
[BUILD] => 5908853
[SHIPTOSTREET] => xxx
[SHIPTOCITY] => xxx
[SHIPTOSTATE] => CA
[SHIPTOZIP] => xxx
[SHIPTOCOUNTRYCODE] => 美国
[SHIPTOCOUNTRY] => 美国
[SHIPTOCOUNTRYNAME] => 美国
[SHIPADDRESSOWNER] => P ayPal
[SHIPADDRESSSTATUS] => 未确认
[BILLINGPERIOD] => Day
[BILLINGFREQUENCY] => 1
[TOTALBILLINGCYCLES] => 0
[CURRENCYCODE] => USD
[ AMT] => 0.10
[SHIPPINGAMT] => 0.00
[TAXAMT] => 0.00
[REGULARBILLINGPERIOD] => Day
[REGULARBILLINGFREQUENCY] => 1
[REGULARTOTALBILLINGCLES] => 0
[REGULARCURRENCYCODE] => 美元
[REGULARAMT] => 0.10
[REGULARSHIPPINGAMT] => 0.00
[REGULARTAXAMT] => 0.00

【问题讨论】:

  • 究竟是什么问题,请更具体!
  • 我想在 Sandbox Paypal 中列出所有创建的定期付款配置文件?就是上面的返回结果!但我不...请帮帮我!
  • 我想得到这些类型的响应。在php中怎么可能?使用“GetRecurringPaymentsProfileDetails”方法

标签: php paypal express-checkout


【解决方案1】:

这是获得所需结果的示例。 请设置您的 Api 用户名、Api 密码、Api 签名和您的 SubscID。享受

<?php
/** GetTransactionDetails NVP example; last modified 08MAY23.
 *
 *  Get detailed information about a single transaction. 
*/
$environment = 'sandbox';   //sandbox or 'beta-sandbox' or 'live'
/**
 * Send HTTP POST Request
 *
 * @param   string  The API method name
 * @param   string  The POST Message fields in &name=value pair format
 * @return  array   Parsed HTTP Response body
 */
function PPHttpPost($methodName_, $nvpStr_) {
    global $environment;
    // Set up your API credentials, PayPal end point, and API version.
    $API_UserName = urlencode('yourApiUserName');
    $API_Password = urlencode('yourApiPassword');
    $API_Signature = urlencode('yourApiSignature');

    $API_Endpoint = "https://api-3t.paypal.com/nvp";
    if("sandbox" === $environment || "beta-sandbox" === $environment) {
        $API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
    }
    $version = urlencode('51.0');
    // 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=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$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) {
        exit("$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.");
    }
    return $httpParsedResponseAr;
}

// Set request-specific fields.
$PROFILEID = urlencode('yourSubsc_ID');

// Add request-specific fields to the request string.
$nvpStr = "&PROFILEID=$PROFILEID";
// Execute the API operation; see the PPHttpPost function above.
$recurringPaymentProfileDetails = PPHttpPost('GetRecurringPaymentsProfileDetails', $nvpStr); // Docuemntation => // https://developer.paypal.com/docs/classic/api/merchant/GetRecurringPaymentsProfileDetails_API_Operation_NVP/
//echo "Current date: ". date("H:i:s");
if("SUCCESS" == strtoupper($recurringPaymentProfileDetails["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($recurringPaymentProfileDetails["ACK"])) {
    /*
    $data_org_billing_success['next_scheduled_billing_date'] = str_replace ('%2d', '-', $recurringPaymentProfileDetails['NEXTBILLINGDATE']);
    $data_org_billing_success['next_scheduled_billing_date'] = str_replace ('%3a', ':', $data_org_billing_success['next_scheduled_billing_date']);
    $data_org_billing_success['no_of_billing_cycle_completed'] = "no_of_billing_cycle_completed+1";
    $data_org_billing_success['no_of_billing_cycle_remaining'] = "total_billing_cycle-no_of_billing_cycle_completed";
    $data_org_billing_success['current_outstanding_balance'] = str_replace ('%2e', '.',$recurringPaymentProfileDetails['OUTSTANDINGBALANCE']);
    $data_org_billing_success['amount_of_last_successful_payment'] = str_replace ('%2e', '.',$recurringPaymentProfileDetails['LASTPAYMENTAMT']);
    $data_org_billing_success['total_paid_amount'] = "total_paid_amount+".$data_org_billing_success['amount_of_last_successful_payment'];
    $data_org_billing_success['date_of_last_successful_payment'] = str_replace ('%2d', '-', $recurringPaymentProfileDetails['LASTPAYMENTDATE']);
    $data_org_billing_success['date_of_last_successful_payment'] = str_replace ('%3a', ':',  $data_org_billing_success['date_of_last_successful_payment']);

    print_r($data_org_billing_success);
    exit;
    */
    //print_r( $recurringPaymentProfileDetails );
    print_r( var_export($recurringPaymentProfileDetails,true) );

    //exit('GetTransactionDetails Completed Successfully: '.print_r($recurringPaymentProfileDetails, true));
} else  {
    exit('GetTransactionDetails failed: ' . print_r($recurringPaymentProfileDetails, true));
}
?>

【讨论】:

    【解决方案2】:

    如果您需要一个 API 来列出 PayPal 中所有创建的定期付款配置文件,目前 PayPal 还没有该 API。唯一存在且功能强大的 API 是 GetRecurringPaymentsProfileDetails,就像您之前调用的那样。我附上了 Recurring Payments / Reference Transactions 的可用 API 列表

    【讨论】:

    • PayPal 没有 API 来列出所有创建的定期配置文件。只有 GetRecurringPaymentsProfileDetails 可用,但此 API 仅返回详细的特定重复配置文件。
    • 我看到更多的论坛讨论它!它需要一个参数 PROFILEID 和操作 GetRecurringPaymentsProfileDetails。我尝试但它不起作用。返回结果 ACK = failure
    猜你喜欢
    • 2013-05-10
    • 2014-11-24
    • 2015-11-08
    • 2014-11-11
    • 2017-07-08
    • 2016-03-15
    • 2013-12-14
    • 2011-10-11
    • 2010-10-17
    相关资源
    最近更新 更多