プロジェクトでは、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);
}