How to get secure token when using “Hosted Checkou

2019-08-28 17:33发布

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

2条回答
劳资没心,怎么记你
2楼-- · 2019-08-28 17:49

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.

查看更多
我想做一个坏孩纸
3楼-- · 2019-08-28 18:10

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" />

查看更多
登录 后发表回答