【问题标题】:Use Paypal to accept credit card payment in the website使用Paypal在网站接受信用卡支付
【发布时间】:2013-02-06 07:37:51
【问题描述】:

我想知道它是否可以实现:

我想在我自己的网站上接受用户的信用卡付款。假设我有一种捕获信用卡信息的形式,理想情况下,我想将客户端中的所有信息(根本不通过服务器)发布到 Paypal 以处理并让 Paypal 处理付款并重定向回我的网站。

由于 PCI 合规性,所有信用卡信息都不会通过我的服务器。我能从paypal获得的唯一信息是支付成功或失败以及在网站上完成交易所需的一些非敏感信息。

我发现 Payflow pro 可能是一个解决方案,但我不知道如何构建 nvp 请求并重定向到 Paypal。在服务器端使用 SDK 很容易,但不幸的是我不能使用它。

谁能帮我解决这个问题?

提前致谢, LD

【问题讨论】:

    标签: paypal credit-card


    【解决方案1】:

    看看DoDirectPayment API

    这应该对你有帮助。

    【讨论】:

      【解决方案2】:

      我正在使用此代码。

      $infos = array(
                  'METHOD' => 'DoDirectPayment', 
                  'USER' => $paypal_pros_username, 
                  'PWD' => $paypal_pros_password, 
                  'SIGNATURE' => $paypal_pros_signature, 
                  'VERSION' => urlencode('115'), 
                  'PAYMENTACTION' => $_POST['paypal_pros_transaction_type'],
                  'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
                  'CREDITCARDTYPE' => $_POST['creditCardType'], 
                  'ACCT' => $_POST['creditCardNumber'],
                  'EXPDATE' => $_POST['expDateMonth'].$_POST['expDateYear'],
                  'CVV2' => $_POST['cvv2Number'], 
                  //'EMAIL' => $_POST['email'], 
                  'FIRSTNAME' => $_POST['firstName'], 
                  'LASTNAME' => $_POST['lastName'], 
                  'STREET' => $_POST['address1'], 
                  'CITY' => $_POST['city'], 
                  'STATE' => $_POST['state'],                     
                  'ZIP' => $_POST['zip'], 
                  'COUNTRYCODE' => $_POST['country'], 
                  'AMT' => $_POST['amount'], 
                  'CURRENCYCODE' => $_POST['PayPal_pros_curency'], 
                  'DESC' => $_POST['paypal_pro_desc'], 
                  'NOTIFYURL' => 'https://website.com/ipn.php'
                  );
      
      // Loop through $infos array to generate the NVP string.
      $nvp_string = '';
      foreach($infos as $var=>$val)
      {
          $nvp_string .= '&'.$var.'='.urlencode($val);    
      }
      
      // Send NVP string to PayPal and store response
      // Set the curl parameters.
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $strPurchaseURL);
          curl_setopt($ch, CURLOPT_VERBOSE, 1);
          // Turn off the server and peer verification (TrustManager Concept).
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_POST, 1);
          // Set the request as a POST FIELD for curl.
          curl_setopt($ch, CURLOPT_POSTFIELDS, $nvp_string);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
      
      
      // Get response from the server.
      $result = curl_exec($ch);
      
      // Parse the API response
      parse_str($result, $output);
      
          if(array_key_exists('ACK', $output)){
      
      print_r($output);
      
                  if($output['ACK']=="Success"){
                      //Success Email or save data in database etc...
      
                      }
                  elseif($output['ACK']=="Failure"){
                      //Failure Email or send any error etc...
      
                      }
                  else {
                      echo 'There is any error! Please go back and try again.';
                      }   
              }
          else {
              echo 'There is any error! Please go back and try again.';
              }
      

      【讨论】:

        猜你喜欢
        • 2015-07-14
        • 2019-09-10
        • 1970-01-01
        • 2015-01-26
        • 2013-12-25
        • 2013-07-31
        • 2013-11-30
        • 2014-09-10
        • 2010-11-03
        相关资源
        最近更新 更多