Reply
Member
Posts: 7
Registered: ‎03-25-2017
Accepted Solution

error in hostedPaymentReturn URL with equal sign

I am trying to migrate to your new API.  The problem I have is my script requires a parameter to know which area it is used in.  (i.e. http://mydomain.com/mystore.cgi?area=onlinestore1)  The problem is every time I try to use that for my return or cancelURL, I get errors that /=/ is not allowed.  Only the base URL is valid.  I know I can use a Iframe or webhook for communication purposes, but I wanted to make this a simple add-in to my current (working) process.  I'll rewrite the whole thing later.  Any suggestions?


Accepted Solutions
Solution
Accepted by topic author tabsoft
‎03-27-2017 10:55 AM
All Star
Posts: 699
Registered: ‎11-03-2016

Re: error in hostedPaymentReturn URL with equal sign

Thanks,

 

I recreated it on my end, and realized you're not url encoding the whole URL. Change to the hex value for the "&" sign as well, and it should work just fine.

View solution in original post


All Replies
All Star
Posts: 699
Registered: ‎11-03-2016

Re: error in hostedPaymentReturn URL with equal sign

Hi @tabsoft,

 

Are you URL encoding the URL? (i.e., replacing the "=" with "%3D"?)

Member
Posts: 7
Registered: ‎03-25-2017

Re: error in hostedPaymentReturn URL with equal sign

I tried that, and I got an error for the % sign as well.

Tom
All Star
Posts: 699
Registered: ‎11-03-2016

Re: error in hostedPaymentReturn URL with equal sign

Can you post an example of the request you're making? Can you also post an example of the exact error message you're receiving?

Member
Posts: 7
Registered: ‎03-25-2017

Re: error in hostedPaymentReturn URL with equal sign

Here is my redacted request (partial)

    <hostedPaymentSettings>
        <setting>
            <settingName>hostedPaymentButtonOptions</settingName>
            <settingValue>{"text": "Pay"}</settingValue>
        </setting>
        <setting>
            <settingName>hostedPaymentReturnOptions</settingName>
            <settingValue>{"url":"https://xxxxx.com/mystore.cgi?uid%3DYFf2vQAA1490328330&config%3Dconfig1.txt","urlText":"Continue","cancelUrl":"<<CancelURL>>","cancelUrlText":"Cancel"}</settingValue>
        </setting>

 

and the error:

 { 
'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd', 
'messages' => { 'resultCode' => 'Error', 
'message' => { 'text' => '\'%\' is an unexpected token. The expected token is \';\'. Line 54, position 128.', 'code' => 'E00003' } }, 
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema' };

 

And it works if I leave off everything after '.cgi'.

 

Tom...

All Star
Posts: 699
Registered: ‎11-03-2016

Re: error in hostedPaymentReturn URL with equal sign

Any more details you can give me? Are you doing this through one of our SDKs? If so, which one? And, if so, could you post the code that creates the request?

 

 

Highlighted
Member
Posts: 7
Registered: ‎03-25-2017

Re: error in hostedPaymentReturn URL with equal sign

I am posting to: "https://apitest.authorize.net/xml/v1/request.api";

 

I am using the AcceptHosted API and I am attempting to get a Token.

 

Tom...

Solution
Accepted by topic author tabsoft
‎03-27-2017 10:55 AM
All Star
Posts: 699
Registered: ‎11-03-2016

Re: error in hostedPaymentReturn URL with equal sign

Thanks,

 

I recreated it on my end, and realized you're not url encoding the whole URL. Change to the hex value for the "&" sign as well, and it should work just fine.

Member
Posts: 7
Registered: ‎03-25-2017

Re: error in hostedPaymentReturn URL with equal sign

Thank you. You are correct.  Fixed that and it seems to work now.  I had no idea it would be an encoding error.  Unfortunately, all the sample code does not show anything but simple URLs for the return URLs.

 

Tom...