/** * Prepare call - get a non-empty product code */ $productListing = Client::searchProducts(['Limit' => 1, 'Enabled' => true, 'Types' => ['REGULAR']]); if (empty($productListing)) { die('No enabled products were found.'); } $productCode = $productListing[0]->ProductCode; if (empty($productCode)) { die('Choose a product with a valid product code'); } /** * Prepare call - prepare order object */ $order = ['Items' => [0 => ['Code' => $productCode, 'Quantity' => 1]], 'BillingDetails' => ['FirstName' => 'John', 'LastName' => 'Doe', 'Email' => '*****@*****.**', 'CountryCode' => 'RO'], 'PaymentDetails' => ['Type' => 'CC', 'Currency' => 'EUR', 'PaymentMethod' => ['CardType' => 'visa', 'CardNumber' => '4111111111111111', 'CCID' => '123', 'ExpirationMonth' => '10', 'ExpirationYear' => '2020', 'HolderName' => 'John Doe']]]; $responsePlaceOrder = Client::placeOrder($order); echo json_encode($responsePlaceOrder, JSON_PRETTY_PRINT); // output: // // { // "RefNo": "11331111", // "OrderNo": 0, // "ExternalReference": null, // "ShopperRefNo": null, // "Status": "PENDING", // "ApproveStatus": "WAITING", // "VendorApproveStatus": "OK", // "Language": "ro", // "OrderDate": "2015-11-18 16:47:07", // "FinishDate": null, // "Source": null,