How to get the customdata by trackGoal

For this function:
trackGoal( idGoal, [customRevenue], [customVars])

if I add some code in tracking code like this:
[…]
var customVars = { ‘orderId’ : order_id,
‘storeId’ : store_id,
‘total’ : total,
‘city’ : city,
‘state’ : state,
‘country’ : country,
};
piwikTracker.trackGoal( 1, 5, customVars );
[…]

How can I get the data of customVars?
I want to write the data of customVars into database which I create, which script of PHP file should I modifiy?

I find a function which can get the data of customVars of trackGoal.
Piwik_Common::getRequestVar(‘data’);

Is there any other method or API which can do this?

For now, yes. You would probably also run json_decode() on the result. The handling of custom data is application-specific and requires an application-specific plugin be written.