2012-01-28 22 views
10

क्या कोई जानता है कि उनके एपीआई का उपयोग करके पेपैल सदस्यता कैसे प्रबंधित करें? मैंने पढ़ा है कि मैं सब्सक्रिप्शन को रद्द, निलंबित और पुनः सक्रिय करने के लिए ManageRecurringPaymentsProfileStatus का उपयोग कर सकता हूं, लेकिन मैं आईडी प्राप्त करने के लिए कोई तरीका नहीं ढूंढ पा रहा हूं इसलिए मैं इसका उपयोग करने में असमर्थ हूं।एपीआई का उपयोग कर पेपैल सदस्यता का प्रबंधन कैसे करें?

This page विधि CreateRecurringPaymentsProfile की प्रतिक्रिया का उपयोग करने के लिए कहता है जिसमें आईडी है, हालांकि मैं एपीआई का उपयोग करके सदस्यता नहीं बना रहा हूं, इसलिए मैं ऐसा करने में सक्षम नहीं हूं।

क्या आईडी प्राप्त करने के लिए कोई एपीआई विधि है? धन्यवाद।

+0

किसी को भी? उस पृष्ठ पर यह कहता है कि आईडी को प्रोफ़ाइल आईडी होना चाहिए, लेकिन कुछ और पढ़ने के बाद ऐसा लगता है कि आप इसके बजाय सदस्यता आईडी का उपयोग कर सकते हैं, तो यह अच्छा है। मुझे यकीन नहीं है कि सदस्यता विवरण और आईडी कैसे प्राप्त करें। –

+2

आप एपीआई के माध्यम से एस-एस से शुरू होने वाली सदस्यता प्रबंधित नहीं कर सकते (आप केवल उन्हें रद्द कर सकते हैं)। I से शुरू होने वाली नई सदस्यता API- के माध्यम से प्रबंधित की जा सकती है, लेकिन फिर केवल सीमित कार्यक्षमता उपलब्ध है। सर्वोत्तम परिणामों के लिए, CreateRecurringPaymentsProfile के माध्यम से एक पुनरावर्ती भुगतान प्रोफ़ाइल बनाएं और उस पर ManageRecurringPaymentsProfileStatus का उपयोग करें। कुछ काम कोड के लिए – Robert

उत्तर

4

Paypal प्रत्यक्ष payment..please अपने रेत बॉक्स के रूप में परिवर्तन क्रेडेंशियल प्रदान की ...

<?php 

/** DoDirectPayment NVP example; last modified 08MAY23. 
* 
* Process a credit card payment. 
*/ 

$environment = '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('debash_1332929919_biz_api1.gmail.com'); 
    $API_Password = urlencode('1332929952'); 
    $API_Signature = urlencode('AIiPJKMw38NGZuaiDaeLWrH9x.WBAK4WXf1vh9.Y.YxEM-4DlbDLMEVe'); 
    $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. 
$paymentType = urlencode('Sale');    // or 'Sale' 
$firstName = urlencode('Debashis'); 
$lastName = urlencode('Banerjee'); 
$creditCardType = urlencode('visa'); 
$creditCardNumber = urlencode('4860795409505688'); 
$expDateMonth = '3'; 
// Month must be padded with leading zero 
$padDateMonth = urlencode(str_pad($expDateMonth, 2, '0', STR_PAD_LEFT)); 

$expDateYear = urlencode('2017'); 
$cvv2Number = urlencode('111'); 
$address1 = urlencode('Kaikala'); 
$address2 = urlencode('Hooghly'); 
$city = urlencode('Kaikala'); 
$state = urlencode('WB'); 
$zip = urlencode('712405'); 
$country = urlencode('IN');    // US or other valid country code 
$amount = urlencode('71'); 
$currencyID = urlencode('USD');       // or other currency ('GBP', 'EUR', 'JPY', 'CAD', 'AUD') 

// Add request-specific fields to the request string. 
$nvpStr = "&PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber". 
      "&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName". 
      "&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID"; 

// Execute the API operation; see the PPHttpPost function above. 
$httpParsedResponseAr = PPHttpPost('DoDirectPayment', $nvpStr); 

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) { 
    exit('Direct Payment Completed Successfully: '.print_r($httpParsedResponseAr, true)); 
} else { 
    exit('DoDirectPayment failed: ' . print_r($httpParsedResponseAr, true)); 
} 

?> 

कृपया देखें https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code

धन्यवाद

+0

+1, धन्यवाद। –

संबंधित मुद्दे