在項目中使用服務引用而不是Web引用。 您應該創建PayPalAPIInterfaceClient或PayPalAPIAAInterfaceClient的一個實例。之後,您將可以調用DoDirectPayment。
實施例:
DoDirectPaymentResponseType result;
using (_client = new PayPalAPIAAInterfaceClient())
{
DoDirectPaymentRequestType pp_Request = new DoDirectPaymentRequestType();
pp_Request.Version = _version;
pp_Request.DoDirectPaymentRequestDetails = new DoDirectPaymentRequestDetailsType();
pp_Request.DoDirectPaymentRequestDetails.IPAddress = ipAddress;
pp_Request.DoDirectPaymentRequestDetails.CreditCard = new CreditCardDetailsType();
pp_Request.DoDirectPaymentRequestDetails.CreditCard.CreditCardNumber = CCNum;
// ..FILL DATA
// NOTE: The only currency supported by the Direct Payment API at this time is US dollars (USD).
pp_Request.DoDirectPaymentRequestDetails.PaymentDetails.OrderTotal.currencyID = CurrencyCodeType.USD;
pp_Request.DoDirectPaymentRequestDetails.PaymentDetails.OrderTotal.Value = amountOfUSD;
var dp = new DoDirectPaymentReq
{
DoDirectPaymentRequest = pp_Request
};
var credentials = new CustomSecurityHeaderType
{
Credentials = new UserIdPasswordType
{
Username = _username,
Password = _password,
Signature = _signature,
AppId = ApiId
}
};
result = _client.DoDirectPayment(ref credentials, dp);
}
我到底救助和所使用的貝寶NVP選項 –