skip to Main Content

I’ve setup a test account for PayPal Payflow Pro, but I’m having authentication issues. Unless i’m using cURL, the api returns “User authentication failed”. I am sure I’m passing the same information as I’ve copied and pasted from the working cURL to PostMan and .net. Am trying to replicate an example API call from:
https://developer.paypal.com/docs/payflow/gs-ppa-hosted-pages/#make-your-first-call

I’d appreciatie any help with this.

cURL Example

Postman failure:

Postman failure

.Net failure:

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    In case anyone wants to see exactly how I changed Postman and .net to work. Thanks again to Preston PHX!

    Text Body: PARTNER=PayPal&VENDOR=&USER=&PWD=&TRXTYPE=S&AMT=40&CREATESECURETOKEN=Y&SECURETOKENID= enter image description here

    .Net Code:

    private string GetSecureToken(string amount, string trxtype)
    {
    var secure = new SecureTokenRequest(true)
    {
        PARTNER = PartnerId,
        VENDOR = VendorId,
        USER = User,
        PWD = Password,
        AMT = amount,
        TRXTYPE = trxtype
        //CREATESECURETOKEN is set by boolean in SecureTokenRequest constructor
        //SECURETOKENID is set in SecureTokenRequest constructor using new Guid to string
    };
    
    var client = new RestClient(Uri);
    
    var request = new RestRequest(Method.POST);
    
    var parameterDict = new Dictionary<string,string>()
    {
        {nameof(secure.PARTNER), secure.PARTNER},
        {nameof(secure.VENDOR), secure.VENDOR},
        {nameof(secure.USER), secure.USER},
        {nameof(secure.PWD), secure.PWD},
        {nameof(secure.TRXTYPE), secure.TRXTYPE},
        {nameof(secure.AMT), secure.AMT},
        {nameof(secure.CREATESECURETOKEN), secure.CREATESECURETOKEN},
        {nameof(secure.SECURETOKENID), secure.SECURETOKENID},
    };
    
    var parameterList = parameterDict.Select(kvp
        => $"{kvp.Key}={kvp.Value}").ToList();
    
    var postBody = string.Join("&", parameterList);
    
    request.AddParameter("text", postBody, ParameterType.RequestBody);
    
    var response = client.Execute(request);
    
    var responseContent = response.IsSuccessful
        ? response.Content
        : $"{response.StatusCode} : {response.ErrorMessage}";
    
    return responseContent;
    }
    

  2. Are there any special characters in your password?

    Try using length tags for your NVP parameters: https://developer.paypal.com/docs/payflow/integration-guide/simple-transaction/#use-special-characters-in-values

    Also make sure the SecureTokenID is unique in every request

    Also don’t think you should be URL encoding values for Payflow

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search