Create Recurring Payment with PayPal API 'Profile is Invalid'

Hi all,

I am trying to setup a recurring payment profile in Paypal (currently sandbox). However I am getting the following error message;

ErrorCode=11581&Desc=Invalid Data&Desc2=Profile description is invalid

I am calling the method as follows;

if (bSandbox)
            pEndPointURL = pEndPointURL_SB;

        NVPCodec encoder = new NVPCodec();
        encoder["METHOD"] = "CreateRecurringPaymentsProfile";
        encoder["TOKEN"] = token;
        encoder["EMAIL"] = payerEmail;
        encoder["PROFILESTARTDATE"] = startdate.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'");
        encoder["BILLINGFREQUENCY"] = "12";
        encoder["BILLINGPERIOD"] = "Month";
        encoder["AMT"] = "19.99";
        encoder["DESC"] = " Monthly Subscription";

        string pStrrequestforNvp = encoder.Encode();
        string pStresponsenvp = HttpCall(pStrrequestforNvp);

        decoder = new NVPCodec();

        string strAck = decoder["ACK"].ToLower();
        if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
            return true;
            retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" +
                "Desc=" + decoder["L_SHORTMESSAGE0"] + "&" +
                "Desc2=" + decoder["L_LONGMESSAGE0"];

            return false;

Open in new window

now from what I can see I am passing this in the DESC.

Am I missing a field?
Who is Participating?
Andrew AngellConnect With a Mentor Co-Owner / DeveloperCommented:
You need to make sure the description value is the same throughout the entire process.  It should be included in SetExpressCheckout in the billing agreement parameters and then again in CreateRecurringPaymentsProfile like you've done.  If it doesn't match exactly this error can happen.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.