locked
PayPal integration - not getting token from Request PDT RRS feed

  • Question

  • User379720387 posted

    At the conclusion of a transaction PayPal will send a token, which my code then appends to my SandBox credentials and return by means of a HttpWebRequest.

    Then PayPal sends the information about the transaction.

    At least that is how it is supposed to work because in my case it always returns FAIL.

    I have verified that the token is being sent by GET in the following fashion:

    sandbox.paypal.com/webapps/billing?country.x=US&locale.x=en_US&token=437543KL67933L

    This is what PayPal call Payment Data Transfer (PDT)

    My listener code is as follows:

    Layout = "~/_SiteLayout.cshtml";
        Page.Title = "PayPal status";
    
        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    
        NLog.LogManager.ThrowExceptions = true;
        NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
    
        string txToken1 = Request.QueryString["token"];
    
        string msgIncoming = String.Format("incoming txToken1 {0}", txToken1);
        logger.Info(msgIncoming);
    
        string authToken = App.ppAuthTokenSB;
    
        string query = String.Format("cmd=_notify-synch&tx={0}&at={1}", txToken1, App.ppAuthTokenSB);
        msgIncoming = String.Format("returnstring: [{0}]", query);
    
        logger.Info(msgIncoming);

    My log file shows the following:

    2020-01-27 15:10:07.1735|INFO|ASP._Page_ppConfirm_cshtml|incoming txToken1 
    2020-01-27 15:10:07.2204|INFO|ASP._Page_ppConfirm_cshtml|returnstring: [cmd=_notify-synch&tx=&at=mysandboxautorizationtoken]
    2020-01-27 15:10:07.2360|INFO|ASP._Page_ppConfirm_cshtml|ppReq.ContentLength 84
    2020-01-27 15:10:07.2360|INFO|ASP._Page_ppConfirm_cshtml|System.Net.HttpWebRequest
    2020-01-27 15:10:07.2360|INFO|ASP._Page_ppConfirm_cshtml|ppReq Headers Content-Type: application/x-www-form-urlencoded

    Note that the return string does not have the token that came with the GET request.

    I have tried both Request.QueryString[] and Request[]

    What am I doing wrong here?

    Tuesday, January 28, 2020 12:39 PM

Answers

  • User379720387 posted

    I.e. do not use PDT with recurring payments, because there is no "tx"

    As per PayPal:

    If you use or plan to use subscription payments, there are two reasons why you might want to avoid using PDT:

    • PDT displays only payment data. Therefore, the PDT page for a subscription payment excludes details such as the subscription's effective date or terms, which most merchants would probably want.
    • Subscriptions that include a free trial won't have payment data on the return page because there was no payment at signup.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 2, 2020 6:18 PM

All replies

  • User409696431 posted

    What is the full URL, not just the Request.QueryString["token"]?     Are you sure you should be looking for "token" as the name of the transaction ID parameter, and not "tx"?

    And, what kind of PayPal integration are you using?  Standard? (https://developer.paypal.com/docs/payment-data-transfer/ )

    "When a customer pays you, PayPal sends the transaction ID of the payment to you by appending the transaction ID to a URL you specify in your account Profile. This information is sent through an HTTP GET request as the tx=transactionID name and value pair:" - https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/paymentdatatransfer/

    Friday, January 31, 2020 4:54 AM
  • User379720387 posted

    I.e. do not use PDT with recurring payments, because there is no "tx"

    As per PayPal:

    If you use or plan to use subscription payments, there are two reasons why you might want to avoid using PDT:

    • PDT displays only payment data. Therefore, the PDT page for a subscription payment excludes details such as the subscription's effective date or terms, which most merchants would probably want.
    • Subscriptions that include a free trial won't have payment data on the return page because there was no payment at signup.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 2, 2020 6:18 PM