I am very much a noob...so please go easy :)
I need to replicate this json using a php json encode:
{
"payment": {
"amount": 10.00,
"memo": "Client x paid with $10.00 of nickles"
}
}
Here is what I am doing, but it doesn't seem to work. I think it has to do with the "payment" key possibly not being represented somehow in the following code?
$params = array(
'payment' => "",
'amount' => $paymentAmount,
'memo' => $memo
);
$content = json_encode($params);
// send to chargify
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);