execute($request); if ($debug) { print "Status Code: {$response->statusCode}\n"; print "Status: {$response->result->status}\n"; print "Order ID: {$response->result->id}\n"; print "Links:\n"; foreach($response->result->links as $link) { print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; } print "Capture Ids:\n"; foreach($response->result->purchase_units as $purchase_unit) { foreach($purchase_unit->payments->captures as $capture) { print "\t{$capture->id}"; } } // To toggle printing the whole response body comment/uncomment below line echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; } return $response; } } /** * This is the driver function which invokes the captureOrder function with * Approved Order Id to capture the order payment. */ if (!count(debug_backtrace())) { CaptureOrder::captureOrder('0F105083N67049335', true); }