function startTransaction() { $msp = new Client(); $msp->setApiKey($this->api_key); $msp->setApiUrl($this->api_url); try { $order_id = time(); $order = $msp->orders->post(array("type" => "redirect", "order_id" => $order_id, "currency" => "EUR", "amount" => 2000, "description" => "Demo Transaction", "var1" => "", "var2" => "", "var3" => "", "items" => "items list", "manual" => "false", "gateway" => "KLARNA", "days_active" => "30", "payment_options" => array("notification_url" => BASE_URL . "notificationController.php?type=initial", "redirect_url" => BASE_URL . "mainController.php?view=klarnaComplete", "cancel_url" => BASE_URL . 'cancelController.php', "close_window" => "true"), "customer" => array("locale" => "nl_NL", "ip_address" => "127.0.0.1", "forwarded_ip" => "127.0.0.1", "first_name" => "Testperson-nl", "last_name" => "Approved", "address1" => "Neherkade", "address2" => "", "house_number" => "1 XI", "zip_code" => "2521VA", "city" => "Gravenhage", "state" => "Zuid holland", "country" => "NL", "phone" => "0612345678", "email" => "*****@*****.**"), "gateway_info" => array("birthday" => "10071970", "bank_account" => "", "phone" => "0612345678", "referrer" => "http://google.nl", "user_agent" => "msp01", "gender" => "male", "email" => "*****@*****.**"), "shopping_cart" => array("items" => array(array("name" => "Test", "description" => "", "unit_price" => "10", "quantity" => "2", "merchant_item_id" => "test123", "tax_table_selector" => "BTW0", "weight" => array("unit" => "KB", "value" => "20")))), "checkout_options" => array("tax_tables" => array("default" => array("shipping_taxed" => "true", "rate" => "0.21"), "alternate" => array(array("standalone" => "true", "name" => "BTW0", "rules" => array(array("rate" => "0.00")))))), "plugin" => array("shop" => "MultiSafepay Toolkit", "shop_version" => TOOLKIT_VERSION, "plugin_version" => TOOLKIT_VERSION, "partner" => "MultiSafepay", "shop_root_url" => "http://www.demo.nl"))); header("Location: " . $msp->orders->getPaymentLink()); } catch (Exception $e) { echo "Error " . htmlspecialchars($e->getMessage()); } }
function startDirectTransaction($issuer) { $msp = new Client(); $msp->setApiKey($this->api_key); $msp->setApiUrl($this->api_url); try { $order_id = time(); $order = $msp->orders->post(array("type" => "direct", "order_id" => $order_id, "currency" => "EUR", "amount" => 1000, "description" => "Demo Transaction", "var1" => "1", "var2" => "2", "var3" => "3", "items" => "items list", "manual" => "false", "gateway" => "IDEAL", "days_active" => "30", "payment_options" => array("notification_url" => BASE_URL . "notificationController.php?type=initial", "redirect_url" => BASE_URL . "mainController.php?view=idealComplete", "cancel_url" => BASE_URL . 'cancelController.php', "close_window" => "true"), "customer" => array("locale" => "nl_NL", "ip_address" => "127.0.0.1", "forwarded_ip" => "127.0.0.1", "first_name" => "Jan", "last_name" => "Modaal", "address1" => "Kraanspoor", "address2" => "", "house_number" => "39", "zip_code" => "1032 SC", "city" => "Amsterdam", "state" => "", "country" => "NL", "phone" => "0208500500", "email" => "*****@*****.**"), "gateway_info" => array("issuer_id" => $issuer), "plugin" => array("shop" => "MultiSafepay Toolkit", "shop_version" => TOOLKIT_VERSION, "plugin_version" => TOOLKIT_VERSION, "partner" => "MultiSafepay", "shop_root_url" => "http://www.demo.nl"))); header("Location: " . $msp->orders->getPaymentLink()); } catch (Exception $e) { echo "Error " . htmlspecialchars($e->getMessage()); } }
function startTransaction() { $msp = new Client(); $msp->setApiKey($this->api_key); $msp->setApiUrl($this->api_url); try { $order_id = time(); $order = $msp->orders->post(array("type" => "checkout", "order_id" => $order_id, "currency" => "EUR", "amount" => 2000, "description" => "Demo Transaction", "var1" => "", "var2" => "", "var3" => "", "items" => "items list", "manual" => "false", "gateway" => "", "days_active" => "30", "payment_options" => array("notification_url" => BASE_URL . "notificationController.php?type=initial", "redirect_url" => BASE_URL . "mainController.php?view=fastcheckoutComplete", "cancel_url" => BASE_URL . 'cancelController.php', "close_window" => "true"), "customer" => array("locale" => "nl_NL", "ip_address" => "127.0.0.1", "forwarded_ip" => "127.0.0.1", "first_name" => "Jan", "last_name" => "Modaal", "address1" => "Kraanspoor", "address2" => "", "house_number" => "39", "zip_code" => "1032 SC", "city" => "Amsterdam", "state" => "", "country" => "NL", "phone" => "0208500500", "email" => "*****@*****.**"), "gateway_info" => array("birthday" => "1980-01-30", "bank_account" => "2884455", "phone" => "0208500500", "referrer" => "http://google.nl", "user_agent" => "msp01"), "shopping_cart" => array("items" => array(array("name" => "Test", "description" => "", "unit_price" => "10", "quantity" => "2", "merchant_item_id" => "test123", "tax_table_selector" => "BTW0", "weight" => array("unit" => "KB", "value" => "20")))), "checkout_options" => array("no-shipping-methods" => false, "shipping_methods" => array("flat_rate_shipping" => array(array("name" => "Post Nl - verzending NL", "price" => "7", "currency" => "", "allowed_areas" => array("NL")), array("name" => "TNT verzending", "price" => "9", "excluded_areas" => array("NL", "FR", "ES"))), "pickup" => array("name" => "Ophalen", "price" => "0")), "tax_tables" => array("default" => array("shipping_taxed" => "true", "rate" => "0.21"), "alternate" => array(array("standalone" => "true", "name" => "BTW0", "rules" => array(array("rate" => "0.00")))))), "custom_fields" => array(array("standard_type" => "birthday"), array("standard_type" => "companyname")), "plugin" => array("shop" => "MultiSafepay Toolkit", "shop_version" => TOOLKIT_VERSION, "plugin_version" => TOOLKIT_VERSION, "partner" => "MultiSafepay", "shop_root_url" => "http://www.demo.nl"))); header("Location: " . $msp->orders->getPaymentLink()); } catch (Exception $e) { echo "Error " . htmlspecialchars($e->getMessage()); } }
function getDetails() { $msp = new Client(); $msp->setApiKey($this->api_key); $msp->setApiUrl($this->api_url); try { $transactionid = '1437027267'; //get the order $order = $msp->orders->get($endpoint = 'orders', $transactionid, $body = array(), $query_string = false); } catch (Exception $e) { echo "Error " . htmlspecialchars($e->getMessage()); } return $order; }
function startTransaction() { $msp = new Client(); $msp->setApiKey($this->api_key); $msp->setApiUrl($this->api_url); try { $order_id = time(); $order = $msp->orders->post(array("type" => "direct", "order_id" => $order_id, "currency" => "EUR", "amount" => 1000, "description" => "Demo Transaction", "gateway" => "DIRDEB", "recurring_id" => "9985046659087797728", "days_active" => "30")); //do redirect to recurring view $return_url = substr(BASE_URL, 0, -12) . 'index.php?view=recurringComplete'; header("Location: " . $return_url); } catch (Exception $e) { echo "Error " . htmlspecialchars($e->getMessage()); } }
public function doRefund() { $msp = new Client(); $msp->setApiKey($this->api_key); $msp->setApiUrl($this->api_url); $transactionid = $_GET['transactionid']; //get the order status $order = $msp->orders->get($type = 'orders', $transactionid, $body = array(), $query_string = false); if ($order->status == "completed") { //the transaction status was competed, now we will refund the transaction $endpoint = 'orders/' . $transactionid . '/refunds'; try { $order = $msp->orders->post(array("type" => "refund", "amount" => "20", "currency" => "EUR", "description" => "PHP Wrapper Toolkit Refund"), $endpoint); } catch (Exception $e) { echo "Error " . htmlspecialchars($e->getMessage()); } } $return_url = substr(BASE_URL, 0, -12) . 'index.php?view=refundComplete'; header("location: " . $return_url); }
/** * Creates a new instance of Client * @param array $options * @return Client */ public function createFromArray($options) { $instance = new Client(); $instance->setNetworkId($options['networkId']); $instance->setApiUrl($options['url']); $instance->setLogin($options['login']); $instance->setPassword($options['password']); return $instance; }