Odd error on Post Subscription updates
Hi,
I'm using the PHP API wrapper and when I try to update a subscription I get back this error
<?xml version="1.0" encoding="UTF-8"?> Invalid request for subscription edit -- need post
I've checked the Client.php code & it is going into the POST branch. What else would be causing this error?
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Marc Guyer on 18 Sep, 2011 05:57 PM
The POST probably isn't getting through. I've enabled some extra logging on your account so we can help you troubleshoot. Go ahead and generate that error again, note the time and we'll take a look.
2 Posted by Simon Cast on 18 Sep, 2011 06:04 PM
I just ran it again and produce the same error at 1800
Support Staff 3 Posted by Marc Guyer on 18 Sep, 2011 09:22 PM
Hi Simon -- We've confirmed in our log that we're not receiving your POST params. I suggest logging your request within your app to see what's going on.
4 Posted by Simon Cast on 20 Sep, 2011 05:27 PM
Hi,
I just tried again (1826 BST) and got the same POST requirement error. Could you see if it got through?
Regards,
Simon
Support Staff 5 Posted by Marc Guyer on 20 Sep, 2011 05:40 PM
Confirmed that no POST body is being received. Also confirmed that the request is actually being sent as GET which could simply be because there are no POST vars in the request.
6 Posted by Simon Cast on 21 Sep, 2011 08:37 AM
That is very odd. I'm using the open source PHP wrapper with the call constructed as specified. I also put some debugs into the Client.php to see if it was going into the POST branch and it was.
Is there a particular array structure that is necessary when passing in the POST variables?
Support Staff 7 Posted by Marc Guyer on 21 Sep, 2011 11:53 AM
If you past your code here, maybe I can help.
>
8 Posted by Simon Cast on 21 Sep, 2011 04:56 PM
Hi Marc,
Thanks. Here are the relevant lines of code.
//POST parameters
$data = array('planCode' => sfConfig::get('app_cheddargetter_enterprise'),'method'=>'paypal');
//Instantiate the CheddarGetter_Client
$client = new CheddarGetter_Client(sfConfig::get('app_cheddargetter_host'),
sfConfig::get('app_cheddargetter_username'),
sfConfig::get('app_cheddargetter_password'),
sfConfig::get('app_cheddargetter_application'));
//Edit the subscription
$response = $client->editSubscription($user_id,NULL,$data);
Regards,
Simon
Support Staff 9 Posted by Marc Guyer on 23 Sep, 2011 01:43 PM
Hmm... Well, first of all, that would be a in invalid request anyway even if the POST was getting through.
http://support.cheddargetter.com/kb/api-8/using-paypal-with-the-api...
The
method
,returnUrl
,cancelUrl
are all required if you want to update the payment method.However, this does not explain why the post is not making it to the API. I suggest a bit of troubleshooting code. If you're using the Zend_Http backend, then you can do this:
If you're using cUrl, you'll have to manually add the CURLOPT_VERBOSE option to CheddarGetter_Client around line 725. Then, run it and check STDERR.
10 Posted by Simon Cast on 24 Sep, 2011 12:05 PM
I put the code in and it didn't produce anything of value.
The error was thrown before the echo statements were executed.
When I check the Errors report on the dashboard the POST error is shown.
Support Staff 11 Posted by Marc Guyer on 29 Sep, 2011 10:00 PM
Oops. This line throws the exception:
So you need to catch it in order to continue processing:
Again, the above will only work if you're using the Zend_Http_Client. If you're using curl, you'll need to troubleshoot it a different way.
Dean closed this discussion on 16 Jan, 2013 09:43 PM.