使用“托管结帐页面”时是否可以使用 RestApiSDK 获取安全 token ?如果是这样,请举例说明。 (首选 C#。)
我所指的安全 token 在第 31 页上有描述: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/payflowgateway_guide.pdf
请注意我没有使用“快速结帐”。 (PayPal 文档中的旧 PayPal 产品和新产品之间存在很多混淆。)
我在 StackOverflow 上找到的一个示例存在以下问题: SDK 和文档的链接已失效。 DOSecureTokenAuth.cs 文件在我能找到的任何 SDK 或示例中都不存在。 PayPal's Payflow Gateway SDK Example not working
在此示例中,作者无法从源文件中复制代码。 http://forums.asp.net/t/1798900.aspx/1
谢谢, 查克
最佳答案
https://github.com/paypal/rest-api-sdk-dotnet请看看这个
或者你可以使用
payflow_dotnet.dll
请查看 payflow_dotnet.dll 的这段代码
public void CreateAuthorization()
{
// Create the Payflow Connection data object with the required connection details.
// The PAYFLOW_HOST property is defined in the webconfig
PayflowConnectionData Connection = new PayflowConnectionData();
// Create Invoice
Invoice Inv = new Invoice();
// Set Amount
Currency Amt = new Currency(new decimal(premiumAmount), "USD");
//adding the amount to invoice
Inv.Amt = Amt;
//creating a new express check out request
ExpressCheckoutRequest currRequest = new ECSetRequest(WebConfigkeys.ReturnToApplication, WebConfigkeys.ReturnToApplication);
PayPalTender currTender = new PayPalTender(currRequest);
//creating a new transaction
SaleTransaction currTransaction = new SaleTransaction(User, Connection, Inv, currTender, PayflowUtility.RequestId);
//submitting the transaction and accepting the response message
Response Resp = currTransaction.SubmitTransaction();
if (Resp != null)
{
TransactionResponse TrxnResponse = Resp.TransactionResponse;
ExpressCheckoutResponse eResponse = Resp.ExpressCheckoutSetResponse;
if ((TrxnResponse != null) && (eResponse != null))
{
eResponse.Token;//get your token
}
}
}
将此添加到 Web Config
<add key="PAYFLOW_HOST" value="pilot-payflowpro.paypal.com" />
关于paypal - 使用 "Hosted Checkout Pages"和 RestApiSDK - ASP.Net 时如何获取安全 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17842213/