Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

paypal express checkout problem -


hi integrating paypal website. want user enter information on site (creditcard information , personal information).

i have down loded paypalfunctions.php paypal developer website.

my code :-

if(isset($_post['submitcard'])) {  $firstname  =trim($_post['firstname']);  $lastname  =trim($_post['lastname']);  $street   =trim($_post['street']);  $city   =trim($_post['city']);  $state   =trim($_post['state']);  $zip   =trim($_post['zip']);  $countrycode =$_post['country'];  $currencycode ='usd';  $paymenttype ='sale';  $paymentamount =$_post['productprice'];  $creditcardtype =$_post['cardtype'];  $creditcardnumber=$_post['cardno'];  $expdate  ='122015';  $cvv2   =$_post['cvv'];  $returnresult=directpayment( $paymenttype, $paymentamount, $creditcardtype, $creditcardnumber,         $expdate, $cvv2, $firstname, $lastname, $street, $city, $state, $zip,          $countrycode, $currencycode );  echo '<pre>';      print_r($returnresult); 

directpayment method in paypalfunctions.php ,

function directpayment( $paymenttype, $paymentamount, $creditcardtype, $creditcardnumber,        $expdate, $cvv2, $firstname, $lastname, $street, $city, $state, $zip,         $countrycode, $currencycode )  {   //construct parameter string describes dodirectpayment   $nvpstr = "&amt=" . $paymentamount;   $nvpstr = $nvpstr . "&currencycode=" . $currencycode;   $nvpstr = $nvpstr . "&paymentaction=" . $paymenttype;   $nvpstr = $nvpstr . "&creditcardtype=" . $creditcardtype;   $nvpstr = $nvpstr . "&acct=" . $creditcardnumber;   $nvpstr = $nvpstr . "&expdate=" . $expdate;   $nvpstr = $nvpstr . "&cvv2=" . $cvv2;   $nvpstr = $nvpstr . "&firstname=" . $firstname;   $nvpstr = $nvpstr . "&lastname=" . $lastname;   $nvpstr = $nvpstr . "&street=" . $street;   $nvpstr = $nvpstr . "&city=" . $city;   $nvpstr = $nvpstr . "&state=" . $state;   $nvpstr = $nvpstr . "&countrycode=" . $countrycode;   $nvpstr = $nvpstr . "&ipaddress=" . $_server['remote_addr'];    $resarray=hash_call("dodirectpayment", $nvpstr);    return $resarray;  }    /**    '-------------------------------------------------------------------------------------------------------------------------------------------    * hash_call: function perform api call paypal using api signature    * @methodname name of api  method.    * @nvpstr nvp string.    * returns associtive array containing response server.    '-------------------------------------------------------------------------------------------------------------------------------------------  */  function hash_call($methodname,$nvpstr)  {   //declaring of global variables   global $api_endpoint, $version, $api_username, $api_password, $api_signature;   global $use_proxy, $proxy_host, $proxy_port;   global $gv_apierrorurl;   global $sbncode;    //setting curl parameters.   $ch = curl_init();   curl_setopt($ch, curlopt_url,$api_endpoint);   curl_setopt($ch, curlopt_verbose, 1);    //turning off server , 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);       //if use_proxy constant set true in constants.php, proxy enabled.     //set proxy name proxy_host , port number proxy_port in constants.php    if($use_proxy)    curl_setopt ($ch, curlopt_proxy, $proxy_host. ":" . $proxy_port);     //nvprequest submitting server   $nvpreq="method=" . urlencode($methodname) . "&version=" . urlencode($version) . "&pwd=" . urlencode($api_password) . "&user=" . urlencode($api_username) . "&signature=" . urlencode($api_signature) . $nvpstr . "&buttonsource=" . urlencode($sbncode);    //setting nvpreq post field curl   curl_setopt($ch, curlopt_postfields, $nvpreq);    //getting response server   $response = curl_exec($ch);    //convrting nvpresponse associative array   $nvpresarray=deformatnvp($response);   $nvpreqarray=deformatnvp($nvpreq);   $_session['nvpreqarray']=$nvpreqarray;    if (curl_errno($ch))    {    // moving display page display curl errors      $_session['curl_error_no']=curl_errno($ch) ;      $_session['curl_error_msg']=curl_error($ch);       //execute error handling module display errors.    }    else    {     //closing curl      curl_close($ch);   }    return $nvpresarray;  }       }     ?> 

it gives error

         array (     [timestamp] => 2010-12-21t06:06:54z     [correlationid] => 1cafc53222e76     [ack] => failure     [version] => 64     [build] => 1620725     [l_errorcode0] => 10002     [l_shortmessage0] => security error     [l_longmessage0] => security header not valid     [l_severitycode0] => error ) 

i cant understand problem going on.please help.

have configure api credentials correctly? can dump hash_call out if needed.

if doing sandbox testing, make sure endpoint of call is: https://api-3t.sandbox.paypal.com/nvp -- pointed 'sandbox'


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -