2014-02-25 72 views
2

我正在嘗試將PayPal rest api集成到我的web應用程序中。挖掘所有可用的來源後,我被卡住了。ASP.NET MVC C#PayPal Rest API - UNAUTHORIZED_PAYMENT

我使用PayPal的REST API例如從這裏: GitHub-PayPal-DotNet-Sample

我更新的NuGet到最新的SDK版本,並取代了cliendId和祕密與我自己的生活鍵。

現在我的問題是,我總是選擇 「CREDIT_CARD」 我得到一個401錯誤響應:

{ 「名」: 「UNAUTHORIZED_PAYMENT」, 「消息」: 「未經授權的支付」, 「 information_link 「:」 https://developer.paypal.com/webapps/developer/docs/api/#UNAUTHORIZED_PAYMENT」, 「debug_id」: 「1d25a990be5db」 }

我設置貨幣爲 「CHF」(應用在瑞士運行)和所述量 「0.05」 用於測試目的。我也檢索一個有效的訪問令牌!

試過各種信用卡有的屬於我的商戶賬戶有的沒有,還是一樣的錯誤。

使用「paypal」選項似乎可行,但我想直接在應用程序內提供信用卡。

瑞士沒有東西嗎?有關此問題的任何建議?我忽略了什麼?

在此先感謝!

示例代碼:

 Payment pay = null; 

     Amount amount = new Amount(); 
     amount.currency = "CHF"; 
     amount.total = "0.05"; 

     Transaction transaction = new Transaction(); 
     transaction.amount = amount; 
     transaction.description = orderDescription; 

     List<Transaction> transactions = new List<Transaction>(); 
     transactions.Add(transaction); 

     FundingInstrument fundingInstrument = new FundingInstrument(); 
     CreditCardToken creditCardToken = new CreditCardToken(); 
     creditCardToken.credit_card_id = GetSignedInUserCreditCardID(email); 
     fundingInstrument.credit_card_token = creditCardToken; 

     List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>(); 
     fundingInstrumentList.Add(fundingInstrument); 

     Payer payer = new Payer(); 
     payer.funding_instruments = fundingInstrumentList; 
     payer.payment_method = paymntMethod.ToString(); //credit_card 

     Payment pyment = new Payment(); 
     pyment.intent = "sale"; 
     pyment.payer = payer; 
     pyment.transactions = transactions; 

     pay = pyment.Create(AccessToken); 

     return pay; 

回答

0

this直接卡支付只在美國,英國(看網頁進一步要求UK)的支持。