How to get secure token when using “Hosted Checkout Pages” and RestApiSDK - ASP.Net

时间秒杀一切 提交于 2019-12-25 18:41:45

问题


Is it possible to use the RestApiSDK to get a secure token when using "Hosted Checkout Pages"? If so please show example. (C# preferred.)

The secure token I am referring to is described on page 31 here: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/payflowgateway_guide.pdf

Please realize that I am not using "Express Checkout". (There is a lot of confusion between the old PayPal products and the new products in the PayPal documentation.)

One example I found here on StackOverflow has the following issues: The links to the SDK and docs are dead. The DOSecureTokenAuth.cs file does not exist in any SDK or example that I can find. PayPal's Payflow Gateway SDK Example not working

In this example the author was not able to copy the code from the source files. http://forums.asp.net/t/1798900.aspx/1

Thank you, Chuck


回答1:


https://github.com/paypal/rest-api-sdk-dotnet please look into this

or you can use

           payflow_dotnet.dll

Please look into this code of 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
            }

        }

}

Add this to Web Config

<add key="PAYFLOW_HOST" value="pilot-payflowpro.paypal.com" />




回答2:


It is not currentlypossible. The REST API's do not support the Hosted Checkout payment method. The REST process allows for PayPal transactions (very similar to Express Checkout) and credit card payments (where you pass the billing information to PayPal for verification).

The post you mentioned - PayPal's Payflow Gateway SDK Example not working - is for the Payflow SDK and Payflow does not support REST.



来源:https://stackoverflow.com/questions/17842213/how-to-get-secure-token-when-using-hosted-checkout-pages-and-restapisdk-asp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!