Looking for example code
Can someone share the typical php code to handle and read the xml post transaction data sent by CG cancellation event???
I need some help and am confused.
Thanks
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 10 Apr, 2011 08:04 PM
Have you seen the official wrapper and quick start guide?
http://support.cheddargetter.com/faqs/api-8/cheddargetter-client-library-quick-start
2 Posted by David on 10 Apr, 2011 09:03 PM
Yes... I've read through that several times.
My confusion is around using something like: $xmlData = file_get_contents("php://input");... but not sure what to follow that up with.
or something else.
Do you have an example of the code to read in the post transaction or cancellation data? Since the data is sent to my .php page, I an struggling on how to read it.
Support Staff 3 Posted by Marc Guyer on 11 Apr, 2011 04:23 PM
Hmm.. I'm not sure why you're trying to do that. The wrapper does it for you. There's quite a bit of example code in the quick start guide. Here's something specific to canceling a customer:
4 Posted by David on 13 Apr, 2011 02:00 AM
I am looking for code to read the 'thecustomercode' and the error reason that come back if a users credit card fails to process a transaction... for example, a credit card fails to process x number of months after subscribing.
I want to store the customer code and reason in my database table and process them... but I can't seem to read the data. I have been using your test button on the "We'll send some POST data here whenever a customer is canceled" test button that sends to my url.
5 Posted by David on 13 Apr, 2011 03:11 AM
I guess I really don't know how to handle the POST transaction (specifically the cancel).
I'm sure its simple, but I am confused.
Sorry... really would appreciate any help you can give me. How do I get the customer code or customer ID of a failed transaction that become cancelled and the reason for the cancel.?
Support Staff 6 Posted by Marc Guyer on 13 Apr, 2011 01:43 PM
David -- Sorry you're having trouble. We'd like to help but we can't provide the type of support you require. You seem to be building a fairly complex system and what you're asking for is more along the lines of a consulting service.
The post hook sends data to your location just like when an HTML form is submitted to the URL you specify.
7 Posted by billing on 13 Apr, 2011 02:56 PM
Marc...
Since "The post hook sends data to your location just like when an HTML form is submitted to the URL you specify."... Do I have to search through all the customer data to find which one failed?
Normally on my forms, I know which customer what being used.... when you post hook back to me, I don't.
I'm not looking for consulting... just trying to understand and how to handle CG's cancellation posts back to my url. Having to search through ALL customer data will be slow.
Support Staff 8 Posted by Marc Guyer on 13 Apr, 2011 07:54 PM
The customer code (which you provide when creating the customer) is intended to be your unique id for the customer in your system. So, when you receive the post hook, you know which customer it is for.
It sounds like you're pulling all customers. You should never need to do this. If you use the customer code effectively, you'll get what you want.
9 Posted by David on 13 Apr, 2011 09:36 PM
Mark... thanks
If a customers credit card fails to successfully process a recurring invoice (aka future invoice)... Can I assume CG will post data back to the url I specified?
If so, how do I know what customer code failed? Assuming its in your post back data... how do I read it?
Thanks again
Support Staff 10 Posted by Marc Guyer on 15 Apr, 2011 02:32 PM
yes
The customer code is in the POST data sent to the URL you specify.
Post data is sent to the URL just like if you created an HTML form with an action of the same URL. It will be in the PHP $_POST array.
Dean closed this discussion on 16 Jan, 2013 04:49 PM.