public function create() { $checkout_payload = array('invoice' => array('items' => $this->items, 'taxes' => $this->taxes, 'total_amount' => $this->getTotalAmount(), 'description' => $this->getDescription()), 'store' => array('name' => Paydunya_Checkout_Store::getName(), 'tagline' => Paydunya_Checkout_Store::getTagline(), 'postal_address' => Paydunya_Checkout_Store::getPostalAddress(), 'phone' => Paydunya_Checkout_Store::getPhoneNumber(), 'logo_url' => Paydunya_Checkout_Store::getLogoUrl(), 'website_url' => Paydunya_Checkout_Store::getWebsiteUrl()), 'custom_data' => $this->showCustomData(), 'actions' => array('cancel_url' => $this->cancel_url, 'return_url' => $this->return_url, 'callback_url' => $this->callback_url)); $result = Paydunya_Utilities::httpJsonRequest(Paydunya_Setup::getCheckoutBaseUrl(), $checkout_payload); switch ($result["response_code"]) { case 00: $this->status = Paydunya::SUCCESS; $this->token = $result["token"]; $this->response_code = $result["response_code"]; $this->response_text = $result["description"]; $this->invoice_url = $result["response_text"]; return true; break; default: $this->invoice_url = ""; $this->status = Paydunya::FAIL; $this->response_code = $result["response_code"]; $this->response_text = $result["response_text"]; return false; break; } }