Json for cclite gateways...

1 view
Skip to first unread message

Hugh Barnard

Feb 22, 2011, 12:58:52 PM2/22/11
to ccl...@googlegroups.com
Hi folks

Just to make you aware of a discussion I had in London a while ago and have started to implement.

Because of the external gateways, it's better that cclite communicates in a consistent and 'processable' way back to the entities it's dealing with Tiki, Drupal, Elgg, Joomla etc..

This, in the medium term answers Xavi's question about error messages too, because, currently if you're not using the standard local web interface they're not handled well or consistently at present.

So [to make a long story shorter] I've started experimenting with json structures to be returned when someone sets mode=json or summary.json in .htaccess for example. This makes it much more RESTy  and consistent too.  I prefer json to xml because it's lighter and the mood seems to be swinging that way..

I've got the Elgg gateway working with this for summary, recent transactions and pay [return of this is still bordelique, to use the french] and it gives a lot of 'local' possibilities just by going $zzz = json_decode($cclite_stuff) in the local PHP.  I've also got a newer .htaccess to go with this that does things like .../summary.json rather than .../summary etc.

I'll stick what's going on on github...the modules concerned are Cclite.pm Ccu.pm and Ccsecure.pm + .htaccess  It should all be backwards compatible but it's development work and I haven't run all the regression tests YMMV, as they say..

The gateway that does this is the Elgg one, I haven't worked on the others yet.. There's an example return below.

Best regards Hugh

"table": "om_transactions", "message":"OK",
"data": [
{"id": "1",

{"id": "66",

{"id": "5",

Reply all
Reply to author
0 new messages