sách gpt4 ai đã đi

c# - 如何从 Paypal 调用 DoDirectPayment API 调用

In lại 作者:太空宇宙 更新时间:2023-11-03 16:11:45 29 4
mua khóa gpt4 Nike

首先,这涉及桌面应用程序而不是 ASP .Net 应用程序。

我已经为我的项目添加了一个 Web 引用,并构建了各种数据对象,例如 PayerInfo、Address 和 CreditCard。但问题是,我实际上如何调用 DoDirectPaymentRequest 并传入对象?根据文档,我使用了 CallerService 和 ProfileFactory 对象,但我没有这些可用的对象。

关于如何从 EXE 调用 API 有什么想法吗?

问候

1 Câu trả lời

在您的项目中使用服务引用而不是网络引用。您应该创建 PayPalAPIInterfaceClient hoặc PayPalAPIAAInterfaceClient 的实例。之后,您将能够调用 DoDirectPayment。

Ví dụ:

        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);
}

关于c# - 如何从 Paypal 调用 DoDirectPayment API 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12147720/

29 4 0
Bài viết được đề xuất: python - 当 QComboBox 设置为可编辑时
Bài viết được đề xuất: Ruby Select 方法(用于数组)问题
Bài viết được đề xuất: c# 屏幕抓取并获取所有 cookie 以安全访问网站
Bài viết được đề xuất: php - 安全警告 Paypal
太空宇宙
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com