i'm currently coding a little api for extole approve conversion api. It's only suppose to send data on declined orders which is equal to cancelled in the magento admin.

Here is what i have written so far:

$data = array(
   'partner_conversion_id' => Mage::getSingleton('checkout/session')->getLastOrderId(),
   'event_status' => 'approve',

$data = '{"partner_conversion_id":"'.Mage::getSingleton('checkout/session')->getLastOrderId().'", "event_status":"approve"}';
$data_string = json_encode($data);

$ch = curl_init('https://api.website.com/v3/events/approve?event_id='.Mage::getSingleton('checkout/session')->getLastOrderId());
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_USERPWD, "11111-1:111111111111111111111");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
$result = curl_exec($ch);
$result = ($result);

When i var_dump($result) on my success.phtml page i get most of what i'm looking for..

string(115) "{"code":"BAD REQUEST","message":"Missing mandatary field value for approval_status","uniqueId":6289418511505278727}"

The uniqueId is the partner_conversion_id which seems to be firing correctly.

So the approval status and the message field which is optional i'm not currently able to get.

Why am i getting BAD REQUEST and how do I get my approval_status to fire?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.