private function initialize() { \MPower_Setup::setMasterKey("da1666f2-fb46-4fa2-b3ca-194992922f49"); \MPower_Setup::setPublicKey("test_public_SgwQ0HO892lCaCGXg2r3kF85o7M"); \MPower_Setup::setPrivateKey("test_private_7eyIvdfBBoUBubMSV4hcqEvQm14"); \MPower_Setup::setMode("test"); \MPower_Setup::setToken("2a4b2b1b9cbf8649e69b"); // Return url \MPower_Checkout_Store::setReturnUrl(url('order/feedback/' . PaymentMethod::PAYMENT_MPOWER)); \MPower_Checkout_Store::setName("MediBig.com"); \MPower_Checkout_Store::setTagline("I can also buy it!"); \MPower_Checkout_Store::setPhoneNumber("0501373573"); //\MPower_Checkout_Store::setPostalAddress("Post office Box AN 10604"); $this->invoice = new \MPower_Checkout_Invoice(); }
public function create($account_alias) { $invoice_data = array('invoice' => array('items' => $this->items, 'taxes' => $this->taxes, 'total_amount' => $this->getTotalAmount(), 'description' => $this->getDescription()), 'store' => array('name' => MPower_Checkout_Store::getName(), 'tagline' => MPower_Checkout_Store::getTagline(), 'postal_address' => MPower_Checkout_Store::getPostalAddress(), 'phone' => MPower_Checkout_Store::getPhoneNumber(), 'logo_url' => MPower_Checkout_Store::getLogoUrl(), 'website_url' => MPower_Checkout_Store::getWebsiteUrl()), 'custom_data' => $this->showCustomData(), 'actions' => array('cancel_url' => $this->cancel_url, 'return_url' => $this->return_url)); $payload = array('invoice_data' => $invoice_data, 'opr_data' => array('account_alias' => $account_alias)); $result = MPower_Utilities::httpJsonRequest(MPower_Setup::getOPRInvoiceUrl(), $payload); switch ($result["response_code"]) { case 00: $this->status = "success"; $this->token = $result["token"]; $this->invoice_token = $result["invoice_token"]; $this->response_code = $result["response_code"]; $this->response_text = $result["response_text"]; return true; break; default: $this->invoice_url = ""; $this->status = "fail"; $this->response_code = $result["response_code"]; $this->response_text = $result["response_text"]; return false; break; } }
public static function setReturnUrl($url) { if (filter_var($url, FILTER_VALIDATE_URL)) { self::$returnUrl = $url; } }
<?php require 'mpower_php/mpower.php'; MPower_Setup::setMasterKey("dd6f2c90-f075-012f-5b69-00155d866600"); MPower_Setup::setPublicKey("live_public_xDPNs0zAJ856YfC3z6rBwGsjqBA"); MPower_Setup::setPrivateKey("live_private_0mhrAda3hiiEfIirJYRC7w77moY"); MPower_Setup::setMode("live"); MPower_Setup::setToken("d13ab6c069296cfff556"); // Configure Checkout Store MPower_Checkout_Store::setName("Awesome Online Store"); MPower_Checkout_Store::setTagline("Awesome localhost.localdomain online store tagline "); MPower_Checkout_Store::setPhoneNumber("0244000001"); MPower_Checkout_Store::setPostalAddress("P. O. Box AN 1010. Accra - Ghana."); // You may set this to your localhost for local testing of redirects // MPower_Checkout_Store::setCancelUrl("http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php"); // MPower_Checkout_Store::setReturnUrl("http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/confirm.php");
MPower_Setup::setPublicKey("test_public_rg2qugm3CWU2J-xvi14KE4-AYGY"); MPower_Setup::setPrivateKey("test_private_eBw1XNZOWtx8XTvDMuZCDZot8I4"); MPower_Setup::setMode("test"); MPower_Setup::setToken("0b8275226b2ec2da5458"); } else { MPower_Setup::setMasterKey("90a2f8a1-7f7b-471f-bdb4-268a270985d4"); MPower_Setup::setPublicKey("live_public_qj5brK9VO3LbA8xSPE8IPtyExf4"); MPower_Setup::setPrivateKey("live_private_b1wT60n7jXB4zlMaC67gIjNDC3s"); MPower_Setup::setMode("live"); MPower_Setup::setToken("314891080ac32d5c94de"); } // Configure Checkout Store MPower_Checkout_Store::setName("CND GLOBAL FASHION"); MPower_Checkout_Store::setTagline("A Touch Of African Fashion"); MPower_Checkout_Store::setPhoneNumber("+3361877452626/+336752517819"); MPower_Checkout_Store::setPostalAddress("130 Grande Rue 92310 \n Paris Servres"); //$invoice = new MPower_Checkout(); $invoice = new MPower_Checkout_Invoice(); $invoice->setCancelUrl("http://www.cndglobalfashion.com/Mpower/Cancel.php"); $invoice->setReturnUrl("http://www.cndglobalfashion.com/Mpower/Success.php"); /* Adding items to your invoice is very basic, the parameters expected are name_of_item, quantity, unit_price, total_price and optional item description. */ @session_start(); //@session_destroy(); $i = 0; $ids = ""; $q = 0; $total = 0.0; $tax = 2.0; for (; $i < count($_SESSION['cartid']); $i++) {