2011-09-20 9 views
0

私は自分のデータベースにユーザーのクレジットカード情報などを持っているので、直接支払い方法を実装しようとしています。直接支払方法Paypalの問題

https://cms.paypal.com/cms_content/US/en_US/files/developer/nvp_DoDirectPayment_cs.txt

しかし、私は取得していますエラー「NVPCallerServicesが」が見つかりません。

using System; 
using System.Collections.Generic; 
using System.Text; 
using com.paypal.sdk.services; 
using com.paypal.sdk.profiles; 
using com.paypal.sdk.util; 
using com.paypal.soap.api; 

namespace ASPDotNetSamples 
{ 
    public class DoDirectPayment 
    { 
     public DoDirectPayment() 
     { 
     } 
     public string DoDirectPaymentCode(string paymentAction, string amount, string creditCardType, string creditCardNumber, string expdate_month, string cvv2Number, string firstName, string lastName, string address1, string city, string state, string zip, string countryCode, string currencyCode) 
     { 

      com.paypal.soap.api.DoDirectPaymentReq req = new com.paypal.soap.api.DoDirectPaymentReq(); 


      NVPCallerServices caller = new NVPCallerServices(); 
      IAPIProfile profile = ProfileFactory.createSignatureAPIProfile(); 
      /* 
      WARNING: Do not embed plaintext credentials in your application code. 
      Doing so is insecure and against best practices. 
      Your API credentials must be handled securely. Please consider 
      encrypting them for use in any production environment, and ensure 
      that only authorized individuals may view or modify them. 
      */ 

      // Set up your API credentials, PayPal end point, API operation and version. 
      profile.APIUsername = "sdk-three_api1.sdk.com"; 
      profile.APIPassword = "QFZCWN5HZM8VBG7Q"; 
      profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ"; 
      profile.Environment = "sandbox"; 
      caller.APIProfile = profile; 

      NVPCodec encoder = new NVPCodec(); 
      encoder["VERSION"] = "51.0"; 
      encoder["METHOD"] = "DoDirectPayment"; 

      // Add request-specific fields to the request. 
      encoder["PAYMENTACTION"] = paymentAction; 
      encoder["AMT"] = amount; 
      encoder["CREDITCARDTYPE"] = creditCardType; 
      encoder["ACCT"] = creditCardNumber; 
      encoder["EXPDATE"] = expdate_month; 
      encoder["CVV2"] = cvv2Number; 
      encoder["FIRSTNAME"] = firstName; 
      encoder["LASTNAME"] = lastName; 
      encoder["STREET"] = address1; 
      encoder["CITY"] = city; 
      encoder["STATE"] = state; 
      encoder["ZIP"] = zip; 
      encoder["COUNTRYCODE"] = countryCode; 
      encoder["CURRENCYCODE"] = currencyCode; 

      // Execute the API operation and obtain the response. 
      string pStrrequestforNvp = encoder.Encode(); 
      string pStresponsenvp = caller.Call(pStrrequestforNvp); 

      NVPCodec decoder = new NVPCodec(); 
      decoder.Decode(pStresponsenvp); 
      return decoder["ACK"]; 

     } 
    } 
} 

これはリンクである:これは、私が言及していたサンプルです。私はすでにpaypal_baseへの参照を持っています。誰が問題を教えてくれますか?

答えて

3

うん、ペイパルのAPIのthats :)

サンプルはおそらく少し時代遅れです。 NVPCallerServicesクラスの名前はCallerServicesとなっているようです。

だから私は、私は、最新のドキュメントを参照していますので、それが起こることを期待していなかったラインに

CallerServices caller = new CallerServices(); 
+1

NVPCallerServices caller = new NVPCallerServices(); 

を交換しよう - 自分のサイトに1つずつ。 Paypalは大変です。なぜクライアントがそれを好むか分からない。 – Jaggu

+0

PayPalのように感じるsdks apiのドキュメンテーションサイトと支払い製品の無数のバージョンは、Web上に広がって...その本当に嫌な:) – Jan

+0

Paypalのドキュメントの吸う - 私はどのように私はこの答え。 –

関連する問題