├── .gitignore ├── views ├── notification.php ├── footer.php ├── header.php ├── return.php ├── recurringComplete.php ├── refundComplete.php ├── cancel.php ├── details.php ├── directideal.php ├── splitpayment.php ├── refund.php ├── recurringpayment.php ├── gateways.php ├── connectComplete.php ├── idealComplete.php ├── content.php ├── klarnaComplete.php ├── payafterComplete.php └── fastcheckoutComplete.php ├── assets ├── images │ ├── favicon.ico │ ├── icon-ideal.png │ ├── iDEAL-groot.gif │ ├── icon-connect.png │ ├── icon-klarna.png │ ├── icon-fastcheckout.png │ ├── icon-get-details.png │ ├── icon-gateway-request.png │ ├── icon-split-payments.png │ ├── icon-pay-after-delivery.png │ ├── icon-recurring-payments.png │ ├── icon-transaction-refund.png │ ├── icon-update-transaction.png │ ├── multisafepay-logo-white.svg │ └── multisafepaylogo.svg └── css │ └── style.css ├── controllers ├── cancelController.php ├── mainController.php ├── detailsController.php ├── updateController.php ├── notificationController.php ├── recurringController.php ├── splitpaymentController.php ├── connectController.php ├── idealController.php ├── gatewayController.php ├── klarnaController.php ├── payafterdeliveryController.php ├── refundController.php └── fastcheckoutController.php ├── index.php ├── models └── API │ ├── Object │ ├── Issuers.php │ ├── Gateways.php │ ├── Orders.php │ └── Core.php │ ├── Autoloader.php │ └── Client.php ├── composer.json ├── config └── config.php ├── LICENSE.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject -------------------------------------------------------------------------------- /views/notification.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /views/footer.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/favicon.ico -------------------------------------------------------------------------------- /assets/images/icon-ideal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-ideal.png -------------------------------------------------------------------------------- /assets/images/iDEAL-groot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/iDEAL-groot.gif -------------------------------------------------------------------------------- /assets/images/icon-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-connect.png -------------------------------------------------------------------------------- /assets/images/icon-klarna.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-klarna.png -------------------------------------------------------------------------------- /assets/images/icon-fastcheckout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-fastcheckout.png -------------------------------------------------------------------------------- /assets/images/icon-get-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-get-details.png -------------------------------------------------------------------------------- /assets/images/icon-gateway-request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-gateway-request.png -------------------------------------------------------------------------------- /assets/images/icon-split-payments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-split-payments.png -------------------------------------------------------------------------------- /assets/images/icon-pay-after-delivery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-pay-after-delivery.png -------------------------------------------------------------------------------- /assets/images/icon-recurring-payments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-recurring-payments.png -------------------------------------------------------------------------------- /assets/images/icon-transaction-refund.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-transaction-refund.png -------------------------------------------------------------------------------- /assets/images/icon-update-transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiSafepay/PHP/HEAD/assets/images/icon-update-transaction.png -------------------------------------------------------------------------------- /controllers/cancelController.php: -------------------------------------------------------------------------------- 1 | cancelTransaction(); 7 | 8 | class cancelController { 9 | 10 | public function cancelTransaction() { 11 | 12 | $cancel_url = substr(BASE_URL, 0, -12) . 'index.php?view=cancel'; 13 | header("Location: " . $cancel_url); 14 | } 15 | 16 | } 17 | 18 | ?> -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /models/API/Object/Issuers.php: -------------------------------------------------------------------------------- 1 | success = $result->success; 13 | $this->data = $result->data; 14 | 15 | return $this->data; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /models/API/Object/Gateways.php: -------------------------------------------------------------------------------- 1 | success = $result->success; 12 | $this->data = $result->data; 13 | 14 | return $this->data; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /models/API/Autoloader.php: -------------------------------------------------------------------------------- 1 | =5.3.0" 21 | }, 22 | "require": {} 23 | } 24 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /controllers/mainController.php: -------------------------------------------------------------------------------- 1 | redirect(); 7 | 8 | class mainController { 9 | 10 | /** 11 | * This function will be called when returning the consumer back to the webshop. Within this function you can update the order (first request the transaction status then), or redirect the consumer back to your stores thank you page. 12 | */ 13 | public function redirect() { 14 | 15 | if (isset($_GET['view'])) { 16 | $view = "view=" . $_GET['view']; 17 | } else { 18 | $view = "view=return"; 19 | } 20 | 21 | $return_url = substr(BASE_URL, 0, -12) . 'index.php?' . $view . '&transactionid=' . $_GET['transactionid']; 22 | header("Location: " . $return_url); 23 | } 24 | 25 | } 26 | 27 | ?> -------------------------------------------------------------------------------- /controllers/detailsController.php: -------------------------------------------------------------------------------- 1 | api_key = API_KEY; 16 | $this->api_url = API_URL; 17 | } 18 | 19 | function getDetails() { 20 | $msp = new \MultiSafepayAPI\Client; 21 | $msp->setApiKey($this->api_key); 22 | $msp->setApiUrl($this->api_url); 23 | try { 24 | $transactionid = '1437027267'; 25 | 26 | //get the order 27 | $order = $msp->orders->get($endpoint = 'orders', $transactionid, $body = array(), $query_string = false); 28 | } catch (Exception $e) { 29 | echo "Error " . htmlspecialchars($e->getMessage()); 30 | } 31 | return $order; 32 | } 33 | 34 | } 35 | 36 | ?> -------------------------------------------------------------------------------- /views/header.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | PHP Wrapper | MultiSafepay 16 | 17 | 18 | -------------------------------------------------------------------------------- /models/API/Object/Orders.php: -------------------------------------------------------------------------------- 1 | success = $result->success; 12 | $this->data = $result->data; 13 | return $result; 14 | } 15 | 16 | public function get($type = 'orders', $id, $body = array(), $query_string = false) { 17 | $result = parent::get($type, $id, $body, $query_string); 18 | $this->success = $result->success; 19 | $this->data = $result->data; 20 | return $this->data; 21 | } 22 | 23 | public function post($body, $endpoint = 'orders') { 24 | $result = parent::post(json_encode($body), $endpoint); 25 | $this->success = $result->success; 26 | $this->data = $result->data; 27 | return $this->data; 28 | } 29 | 30 | public function getPaymentLink() { 31 | return $this->data->payment_url; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 MultiSafepay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /controllers/updateController.php: -------------------------------------------------------------------------------- 1 | startUpdateTransaction(); 16 | 17 | class updateController { 18 | 19 | private $api_key = ''; 20 | private $api_url = ''; 21 | 22 | function __construct() { 23 | $this->api_key = API_KEY; 24 | $this->api_url = API_URL; 25 | } 26 | 27 | function startUpdateTransaction() { 28 | $msp = new \MultiSafepayAPI\Client; 29 | $msp->setApiKey($this->api_key); 30 | $msp->setApiUrl($this->api_url); 31 | 32 | $transactionid = '1441193361'; 33 | $endpoint = 'orders/' . $transactionid; 34 | 35 | try 36 | { 37 | $order = $msp->orders->patch( 38 | array( 39 | "tracktrace_code" => 'null', 40 | "carrier"=> 'null', 41 | "ship_date"=> date('Y-m-d H:i:s'), 42 | "reason" => 'Shipped' 43 | ), $endpoint); 44 | } catch (Exception $e) 45 | { 46 | echo "Error " . htmlspecialchars($e->getMessage()); 47 | } 48 | } 49 | } 50 | 51 | ?> -------------------------------------------------------------------------------- /views/return.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

You transaction has been processed, if your payment was successful then you can start processing the order.

17 |
18 |

You can click here to return to the MultiSafepay toolkit

19 | 20 |
21 |
22 | 23 |
24 |
25 |
26 |
27 | 35 |
-------------------------------------------------------------------------------- /controllers/notificationController.php: -------------------------------------------------------------------------------- 1 | linkNotification(); 9 | } else { 10 | $notification->updateOrder(); 11 | } 12 | 13 | class notificationController { 14 | 15 | /** 16 | * This function is used for Notification urls that are beeing used to update the order, but as an answer to MultiSafepay respond with a link back to the store 17 | */ 18 | public function linkNotification() { 19 | 20 | 21 | /* 22 | * Within this function you should request the status of the transaction to get all transaction details, based on that information you should update the order and respond with a link 23 | */ 24 | 25 | $return_url = substr(BASE_URL, 0, -12) . 'index.php'; 26 | 27 | echo 'Click here to return to the store.'; 28 | } 29 | 30 | public function updateOrder() { 31 | /* 32 | * Within this function you should request the status of the transaction to get all transaction details, based on that information you should update the order and respond with an OK to inform * MultiSafepay that the updating of the order was succesful 33 | */ 34 | 35 | echo "ok"; 36 | } 37 | 38 | } 39 | 40 | ?> -------------------------------------------------------------------------------- /views/recurringComplete.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

Your Recurring transaction has been processed, you can now start the order processing

17 |
18 |
19 |

You can click here to return to the MultiSafepay toolkit

20 |
21 |
22 |
23 | 24 |
25 |
26 |
27 |
28 | 36 |
-------------------------------------------------------------------------------- /views/refundComplete.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 14 |
15 |
16 |
17 |

Your refund has been processed

18 |
19 |

Your refund request is now processed and your order should be updated accordingly.

20 |
21 |

You can click here to return to the MultiSafepay toolkit

22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 |
30 | 38 |
-------------------------------------------------------------------------------- /views/cancel.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

You have cancelled your transaction.

14 |
15 |

The order should now have been cancelled within your store and the customer should return to the checkout process so he/she can again try to place the order

16 |
17 |

You can click here to return to the MultiSafepay toolkit

18 | 19 |
20 |
21 | 22 |
23 |
24 |
25 |
26 | 34 |
-------------------------------------------------------------------------------- /models/API/Object/Core.php: -------------------------------------------------------------------------------- 1 | mspapi = $mspapi; 11 | } 12 | 13 | public function post($body, $endpoint = 'orders') { 14 | $this->result = $this->processRequest('POST', $endpoint, $body); 15 | return $this->result; 16 | } 17 | 18 | public function patch($body, $endpoint = '') { 19 | $this->result = $this->processRequest('PATCH', $endpoint, $body); 20 | return $this->result; 21 | } 22 | 23 | public function getResult() { 24 | return $this->result; 25 | } 26 | 27 | public function get($endpoint, $id, $body = array(), $query_string = false) { 28 | if (!$query_string) { 29 | $url = "{$endpoint}/{$id}"; 30 | } else { 31 | $url = "{$endpoint}?{$query_string}"; 32 | } 33 | 34 | 35 | $this->result = $this->processRequest('GET', $url, $body); 36 | return $this->result; 37 | } 38 | 39 | protected function processRequest($http_method, $api_method, $http_body = NULL) { 40 | $body = $this->mspapi->processAPIRequest($http_method, $api_method, $http_body); 41 | if (!($object = @json_decode($body))) { 42 | throw new \Exception("'{$body}'."); 43 | } 44 | 45 | if (!empty($object->error_code)) { 46 | $exception = new \Exception("{$object->error_code}: {$object->error_info}."); 47 | throw $exception; 48 | } 49 | return $object; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /controllers/recurringController.php: -------------------------------------------------------------------------------- 1 | startTransaction(); 12 | 13 | class recurringController { 14 | 15 | private $api_key = ''; 16 | private $api_url = ''; 17 | 18 | function __construct() { 19 | $this->api_key = API_KEY; 20 | $this->api_url = API_URL; 21 | } 22 | 23 | function startTransaction() { 24 | $msp = new \MultiSafepayAPI\Client; 25 | $msp->setApiKey($this->api_key); 26 | $msp->setApiUrl($this->api_url); 27 | try { 28 | $order_id = time(); 29 | 30 | $order = $msp->orders->post(array( 31 | "type" => "direct", 32 | "order_id" => $order_id, 33 | "currency" => "EUR", 34 | "amount" => 1000, 35 | "description" => "Demo Transaction", 36 | "gateway" => "DIRDEB", //DIRDEB When iDEAL was used for the initial transaction. For VISA, Mastercard etc you can use the same gateway code. 37 | "recurring_id" => "9985046659087797728", // The recurring ID can be found within the response of a status update API call for the initial transaction 38 | "days_active" => "30", 39 | )); 40 | 41 | //do redirect to recurring view 42 | $return_url = substr(BASE_URL, 0, -12) . 'index.php?view=recurringComplete'; 43 | 44 | header("Location: " . $return_url); 45 | } catch (Exception $e) { 46 | echo "Error " . htmlspecialchars($e->getMessage()); 47 | } 48 | } 49 | 50 | } 51 | 52 | ?> -------------------------------------------------------------------------------- /views/details.php: -------------------------------------------------------------------------------- 1 | getDetails(); 6 | ?> 7 | 8 |
9 | 17 |
18 |
19 |
20 |

This example requests the transaction details for an existing transaction

21 |
22 |

The transaction details shown are from an existing transaction on the MultiSafepay test environment with transaction ID 1437027267.
23 | This example is from an iDEAL transaction. The details shown are all available details for this example transaction. 24 |

25 |
26 |
27 |
28 |

You can click here to return to the MultiSafepay toolkit

29 |
30 |
31 |
32 | 33 |
34 |
35 |
36 |
37 | 45 |
-------------------------------------------------------------------------------- /views/directideal.php: -------------------------------------------------------------------------------- 1 | getIssuers(); 6 | ?> 7 | 8 |
9 | 17 |
18 |
19 |
20 |

You have selected direct iDEAL to test an iDEAL transaction

21 |
22 | 23 |

Normally, when you've selected iDEAL as a payment method then you should be able to select the iDEAL issuer during the checkout process. This page simulates that page and would normally be the payment selection or checkout page.

24 |
25 |
26 | 27 |

You have selected iDEAL, please select your issuer and start your transaction

28 |
29 | 30 |
31 |
32 | 33 |
34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 |
42 |
43 | 51 |
-------------------------------------------------------------------------------- /views/splitpayment.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 14 |
15 |
16 |
17 |

You have selected the split payment example

18 |
19 | 20 |

When using Split Payments you can transfer a fixed amount or percentage of the original transaction to another MultiSafepay account.
21 | Using Split Payments can be done by adding specific settings to the transaction request. These settings should be adde to "var3". You can use (examples): 22 |
23 |
24 | 1. affiliate;1001001;1%;split payment; this example will transfer 1% of the original transaction to MultiSafepay account 1001001 with the description "split payment". 25 |
26 | 2. affiliate;1001001;100;split payment; this example will transfer 1 EUR of the original transaction to MultiSafepay account 1001001 with the description "split payment". 27 |

28 |
29 |
30 | Start Split Payment 31 |

32 |
33 |

You can click here to return to the MultiSafepay toolkit

34 |
35 |
36 |
37 | 38 |
39 |
40 |
41 |
42 | 50 |
-------------------------------------------------------------------------------- /views/refund.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 14 |
15 |
16 |
17 |

Your transaction is processed, you can now refund the transaction.

18 |
19 |

Click the refund button to refund the transaction

20 |
21 | 22 | 23 |
24 | 25 |
26 |
27 |
28 |

When refunding a transaction, the following data is being used

29 |
30 |
array(
31 |     "type" => "refund",
32 |     "amount" => "20",
33 |     "currency" => "EUR",
34 |     "description" => "PHP Wrapper Toolkit Refund",
35 | )
36 |
37 | 38 |

This would be a JSON request like

39 |
40 |
 "refund",
43 |             "amount" => "20",
44 |             "currency" => "EUR",
45 |             "description" => "PHP Wrapper Toolkit Refund",
46 |         );
47 | 
48 |         echo json_encode($array);
49 |         ?>
50 |       
51 | 52 |
53 | 54 |
55 |
56 |
57 |
58 | 66 |
-------------------------------------------------------------------------------- /views/recurringpayment.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 14 |
15 |
16 |
17 |

You have selected the Recurring payment example

18 |
19 | 20 |

You can using recurring payments by storing the recurringID from an original transaction. When the recurringID is added to the transaction request, then a new recurring transaction will be created using those details. A recurring payment transaction request would then look like (example) : 21 |

22 |
23 |
 "direct",
27 |               "order_id" => $order_id,
28 |               "currency" => "EUR",
29 |               "amount" => 1000,
30 |               "description" => "Demo Transaction",
31 |               "var3" => "3",
32 |               "var2" => "2",
33 |               "var1" => "1",
34 |               "items" => "items list",
35 |               "manual" => "false",
36 |               "gateway" => "DIRDEB",
37 |               "recurring_id" => "9985046659087797728",
38 |               "days_active" => "30",
39 |           );
40 | 
41 |           print_r($order);
42 |           ?>
43 |         
44 |
45 | Start Recurring Payment 46 |

47 |
48 |
49 | 50 |
51 |
52 |
53 |
54 | 62 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # PHP toolkit for the MultiSafepay API 6 | This is a MultiSafepay Toolkit. With this Toolkit you can test the most common API calls the MultiSafepay JSON API supports. 7 | 8 | ## About MultiSafepay 9 | MultiSafepay is a collecting payment service provider which means we take care of the agreements, technical details and payment collection required for each payment method. You can start selling online today and manage all your transactions from one place. 10 | 11 | ## Requirements 12 | - To use the toolkit you need a MultiSafepay account. You can create a test account on https://testmerchant.multisafepay.com/signup 13 | 14 | ## Authentication 15 | All requests to the MultiSafepay API require authentication. Authentication is provided by including an API Key as an HTTP header in your request. 16 | 17 | The HTTP header name for the API Key is: api_key 18 | 19 | ## Usage 20 | At this point there are examples for: 21 | 22 | 1. MultiSafepay Connect 23 | 2. MultiSafepay FastCheckout 24 | 3. Direct iDEAL (Issuer selection within your store) 25 | 4. Gateway requests (Request the payment methods that are active within your MultiSafepay account) 26 | 5. Refunding 27 | 6. Pay After Delivery 28 | 7. Transaction details request 29 | 8. Split Payments 30 | 9. Recurring Payments 31 | 32 | 33 | 34 | This Toolkit can also be a base for your own integration. Within the models folder you can find the API classes to connect with the MultiSafepay payment server, the controllers folder contains the controllers that can be used 35 | to create your integration. The following controllers contain the API request structures: 36 | 37 | 1. connectController.php 38 | 2. fastcheckoutController.php 39 | 3. idealController.php 40 | 4. gatewayController.php 41 | 5. refundController.php 42 | 6. payafterdeliveryController.php 43 | 7. detailsController.php 44 | 8. splitpaymentController.php 45 | 9. recurringController.php## Usage 46 | 47 | ## Support 48 | If you have any issues, problems or questions you can create an issue on this repository or contact us at integration@multisafepay.com 49 | 50 | ## Mistakes and improvements 51 | If you spot mistakes or want to contribute in improving this toolkit, feel free to [create pull requests](https://github.com/MultiSafepay/PHP/pulls) 52 | 53 | ## API Documentation 54 | [Click here](https://docs.multisafepay.com/api/) for the MultiSafepay API documentation. 55 | ## License 56 | [MIT License](https://github.com/MultiSafepay/PHP/blob/master/LICENSE.md) 57 | 58 | -------------------------------------------------------------------------------- /models/API/Client.php: -------------------------------------------------------------------------------- 1 | orders = new Object\Orders($this); 20 | $this->issuers = new Object\Issuers($this); 21 | $this->gateways = new Object\Gateways($this); 22 | } 23 | 24 | public function getRequest() { 25 | return $this->request; 26 | } 27 | 28 | public function getResponse() { 29 | return $this->response; 30 | } 31 | 32 | public function setApiUrl($url) { 33 | $this->api_url = trim($url); 34 | } 35 | 36 | public function setDebug($debug) { 37 | $this->debug = trim($debug); 38 | } 39 | 40 | public function setApiKey($api_key) { 41 | $this->api_key = trim($api_key); 42 | } 43 | 44 | 45 | public function processAPIRequest($http_method, $api_method, $http_body = NULL) { 46 | if (empty($this->api_key)) { 47 | throw new \Exception("Please configure your MultiSafepay API Key."); 48 | } 49 | 50 | $url = $this->api_url . $api_method; 51 | $ch = curl_init($url); 52 | 53 | $request_headers = array( 54 | "Accept: application/json", 55 | "api_key:" . $this->api_key, 56 | ); 57 | 58 | if ($http_body !== NULL) { 59 | $request_headers[] = "Content-Type: application/json"; 60 | curl_setopt($ch, CURLOPT_POST, 1); 61 | curl_setopt($ch, CURLOPT_POSTFIELDS, $http_body); 62 | } 63 | 64 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 65 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); 66 | curl_setopt($ch, CURLOPT_ENCODING, ""); 67 | curl_setopt($ch, CURLOPT_TIMEOUT, 120); 68 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 69 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 70 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $http_method); 71 | curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers); 72 | 73 | $body = curl_exec($ch); 74 | 75 | if($this->debug){ 76 | $this->request = $http_body; 77 | $this->response = $body; 78 | } 79 | 80 | if (curl_errno($ch)) { 81 | throw new \Exception("Unable to communicatie with the MultiSafepay payment server (" . curl_errno($ch) . "): " . curl_error($ch) . "."); 82 | } 83 | 84 | curl_close($ch); 85 | return $body; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /controllers/splitpaymentController.php: -------------------------------------------------------------------------------- 1 | startTransaction(); 12 | 13 | class splitpaymentController { 14 | 15 | private $api_key = ''; 16 | private $api_url = ''; 17 | 18 | function __construct() { 19 | $this->api_key = API_KEY; 20 | $this->api_url = API_URL; 21 | } 22 | 23 | function startTransaction() { 24 | $msp = new \MultiSafepayAPI\Client; 25 | $msp->setApiKey($this->api_key); 26 | $msp->setApiUrl($this->api_url); 27 | try { 28 | $order_id = time(); 29 | 30 | $order = $msp->orders->post(array( 31 | "type" => "redirect", 32 | "order_id" => $order_id, 33 | "currency" => "EUR", 34 | "amount" => 1000, 35 | "description" => "Demo Transaction", 36 | "var3" => "affiliate;1001001;100;split payment;", // this contains the spit payment data settings. setup like: affiliate;accountid;amount/percentage;description; 37 | "var2" => "2", 38 | "var1" => "1", 39 | "items" => "items list", 40 | "manual" => "false", 41 | "gateway" => "", 42 | "days_active" => "30", 43 | "payment_options" => array( 44 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 45 | "redirect_url" => BASE_URL . "mainController.php", 46 | "cancel_url" => BASE_URL . 'cancelController.php', 47 | "close_window" => "true" 48 | ), 49 | "customer" => array( 50 | "locale" => "nl_NL", 51 | "ip_address" => "127.0.0.1", 52 | "forwarded_ip" => "127.0.0.1", 53 | "first_name" => "Jan", 54 | "last_name" => "Modaal", 55 | "address1" => "Kraanspoor", 56 | "address2" => "", 57 | "house_number" => "39", 58 | "zip_code" => "1032 SC", 59 | "city" => "Amsterdam", 60 | "state" => "", 61 | "country" => "NL", 62 | "phone" => "0208500500", 63 | "email" => "test@test.nl", 64 | ), 65 | "google_analytics" => array( 66 | "account" => "UA-XXXXXXXXX", 67 | ), 68 | "plugin" => array( 69 | "shop" => "MultiSafepay Toolkit", 70 | "shop_version" => TOOLKIT_VERSION, 71 | "plugin_version" => TOOLKIT_VERSION, 72 | "partner" => "MultiSafepay", 73 | "shop_root_url" => "http://www.demo.nl", 74 | ), 75 | "custom_info" => array( 76 | "custom_1" => "value1", 77 | "custom_2" => "value2", 78 | ) 79 | )); 80 | 81 | header("Location: " . $msp->orders->getPaymentLink()); 82 | } catch (Exception $e) { 83 | echo "Error " . htmlspecialchars($e->getMessage()); 84 | } 85 | } 86 | 87 | } 88 | 89 | ?> -------------------------------------------------------------------------------- /controllers/connectController.php: -------------------------------------------------------------------------------- 1 | startTransaction(); 14 | 15 | class connectController { 16 | 17 | private $api_key = ''; 18 | private $api_url = ''; 19 | 20 | function __construct() { 21 | $this->api_key = API_KEY; 22 | $this->api_url = API_URL; 23 | } 24 | 25 | function startTransaction() { 26 | $msp = new \MultiSafepayAPI\Client; 27 | $msp->setApiKey($this->api_key); 28 | $msp->setApiUrl($this->api_url); 29 | try { 30 | $order_id = time(); 31 | 32 | $order = $msp->orders->post(array( 33 | "type" => "redirect", 34 | "order_id" => $order_id, 35 | "currency" => "EUR", 36 | "amount" => 1000, 37 | "description" => "Demo Transaction", 38 | "var1" => "1", 39 | "var2" => "2", 40 | "var3" => "3", 41 | "items" => "items list", 42 | "manual" => "false", 43 | "gateway" => "", 44 | "days_active" => "30", 45 | "payment_options" => array( 46 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 47 | "redirect_url" => BASE_URL . "mainController.php?view=connectComplete", 48 | "cancel_url" => BASE_URL . 'cancelController.php', 49 | "close_window" => "true" 50 | ), 51 | "customer" => array( 52 | "locale" => "nl_NL", 53 | "ip_address" => "127.0.0.1", 54 | "forwarded_ip" => "127.0.0.1", 55 | "first_name" => "Jan", 56 | "last_name" => "Modaal", 57 | "address1" => "Kraanspoor", 58 | "address2" => "", 59 | "house_number" => "39", 60 | "zip_code" => "1032 SC", 61 | "city" => "Amsterdam", 62 | "state" => "", 63 | "country" => "NL", 64 | "phone" => "0208500500", 65 | "email" => "test@test.nl", 66 | ), 67 | "google_analytics" => array( 68 | "account" => "UA-XXXXXXXXX", 69 | ), 70 | "plugin" => array( 71 | "shop" => "MultiSafepay Toolkit", 72 | "shop_version" => TOOLKIT_VERSION, 73 | "plugin_version" => TOOLKIT_VERSION, 74 | "partner" => "MultiSafepay", 75 | "shop_root_url" => "http://www.demo.nl", 76 | ), 77 | "custom_info" => array( 78 | "custom_1" => "value1", 79 | "custom_2" => "value2", 80 | ) 81 | )); 82 | 83 | header("Location: " . $msp->orders->getPaymentLink()); 84 | } catch (Exception $e) { 85 | echo "Error " . htmlspecialchars($e->getMessage()); 86 | } 87 | } 88 | 89 | } 90 | 91 | ?> -------------------------------------------------------------------------------- /views/gateways.php: -------------------------------------------------------------------------------- 1 | getGateways(); 6 | ?> 7 | 8 |
9 | 17 |
18 |
19 |
20 |

You have selected gateway request.

21 |
22 | 23 |

Normally, a gateway request is done to request all gateways active within your MultiSafepay account, based on currency, locale and amount. The request is done in the background, the returned gateways should be added to your checkout process within your store so that customers can use those payment methods to pay their order.

24 |
25 |
26 |

Please select the payment method of your choice and start your transaction

27 |
28 | 29 |
30 |
31 | 32 |
33 |
34 |
35 |
36 |

While loading this page, a gateway request API call was done in the background by using the url below and by using the correct headers

37 |
38 |
https://testapi.multisafepay.com/v1/json/gateways?country=NL¤cy=USD&amount=1000&locale=nl-NL
39 |
40 |

The following response was given:

41 |
42 |
{
43 |     "success": true,
44 |     "data": [
45 |         {
46 |             "id": "VISA",
47 |             "description": "Visa"
48 |         },
49 |         {
50 |             "id": "DIRDEB",
51 |             "description": "Direct Debit \/ Eenmalige machtiging"
52 |         },
53 |         {
54 |             "id": "MASTERCARD",
55 |             "description": "MasterCard"
56 |         },
57 |         {
58 |             "id": "BANKTRANS",
59 |             "description": "Overboeking"
60 |         },
61 |         {
62 |             "id": "PAYAFTER",
63 |             "description": "Betaal Na Ontvangst"
64 |         },
65 |         {
66 |             "id": "PAYPAL",
67 |             "description": "PayPal"
68 |         },
69 |         {
70 |             "id": "IDEAL",
71 |             "description": "iDEAL"
72 |         },
73 |         {
74 |             "id": "INTERSOLVE",
75 |             "description": "Intersolve"
76 |         }
77 |     ]
78 | }
79 |
80 |

You can click here to return to the MultiSafepay toolkit

81 |
82 | 83 |
84 |
85 | 86 |
87 |
88 |
89 |
90 | 98 |
-------------------------------------------------------------------------------- /controllers/idealController.php: -------------------------------------------------------------------------------- 1 | startDirectTransaction($_GET['issuer']); 18 | } 19 | 20 | class idealController { 21 | 22 | private $api_key = ''; 23 | private $api_url = ''; 24 | 25 | function __construct() { 26 | $this->api_key = API_KEY; 27 | $this->api_url = API_URL; 28 | } 29 | 30 | function getIssuers() { 31 | $msp = new \MultiSafepayAPI\Client; 32 | $msp->setApiKey($this->api_key); 33 | $msp->setApiUrl($this->api_url); 34 | try { 35 | $issuers = $msp->issuers->get(); 36 | 37 | $issuer_selection = ''; 42 | } catch (Exception $e) { 43 | echo "Error " . htmlspecialchars($e->getMessage()); 44 | } 45 | 46 | return $issuer_selection; 47 | } 48 | 49 | function startDirectTransaction($issuer) { 50 | $msp = new \MultiSafepayAPI\Client; 51 | $msp->setApiKey($this->api_key); 52 | $msp->setApiUrl($this->api_url); 53 | 54 | try { 55 | $order_id = time(); 56 | 57 | $order = $msp->orders->post(array( 58 | "type" => "direct", 59 | "order_id" => $order_id, 60 | "currency" => "EUR", 61 | "amount" => 1000, 62 | "description" => "Demo Transaction", 63 | "var1" => "1", 64 | "var2" => "2", 65 | "var3" => "3", 66 | "items" => "items list", 67 | "manual" => "false", 68 | "gateway" => "IDEAL", 69 | "days_active" => "30", 70 | "payment_options" => array( 71 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 72 | "redirect_url" => BASE_URL . "mainController.php?view=idealComplete", 73 | "cancel_url" => BASE_URL . 'cancelController.php', 74 | "close_window" => "true" 75 | ), 76 | "customer" => array( 77 | "locale" => "nl_NL", 78 | "ip_address" => "127.0.0.1", 79 | "forwarded_ip" => "127.0.0.1", 80 | "first_name" => "Jan", 81 | "last_name" => "Modaal", 82 | "address1" => "Kraanspoor", 83 | "address2" => "", 84 | "house_number" => "39", 85 | "zip_code" => "1032 SC", 86 | "city" => "Amsterdam", 87 | "state" => "", 88 | "country" => "NL", 89 | "phone" => "0208500500", 90 | "email" => "test@test.nl", 91 | ), 92 | "gateway_info" => array( 93 | "issuer_id" => $issuer, 94 | ), 95 | "plugin" => array( 96 | "shop" => "MultiSafepay Toolkit", 97 | "shop_version" => TOOLKIT_VERSION, 98 | "plugin_version" => TOOLKIT_VERSION, 99 | "partner" => "MultiSafepay", 100 | "shop_root_url" => "http://www.demo.nl", 101 | ) 102 | )); 103 | 104 | header("Location: " . $msp->orders->getPaymentLink()); 105 | } catch (Exception $e) { 106 | echo "Error " . htmlspecialchars($e->getMessage()); 107 | } 108 | } 109 | 110 | } 111 | 112 | ?> -------------------------------------------------------------------------------- /views/connectComplete.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

You transaction has been processed, if your payment was successful then you can start processing the order.

17 |
18 | 19 |

You had selected the Connect example, this transaction was requested using the following data (example):

20 |
21 |
 "redirect",
26 |               "order_id" => $order_id,
27 |               "currency" => "EUR",
28 |               "amount" => 1000,
29 |               "description" => "Demo Transaction",
30 |               "var1" => "1",
31 |               "var2" => "2",
32 |               "var3" => "3",
33 |               "items" => "items list",
34 |               "manual" => "false",
35 |               "gateway" => "",
36 |               "days_active" => "30",
37 |               "payment_options" => array(
38 |                   "notification_url" => BASE_URL . "notificationController.php?type=initial",
39 |                   "redirect_url" => BASE_URL . "mainController.php?view=connectComplete",
40 |                   "cancel_url" => BASE_URL . 'cancelController.php',
41 |                   "close_window" => "true"
42 |               ),
43 |               "customer" => array(
44 |                   "locale" => "nl_NL",
45 |                   "ip_address" => "127.0.0.1",
46 |                   "forwarded_ip" => "127.0.0.1",
47 |                   "first_name" => "Jan",
48 |                   "last_name" => "Modaal",
49 |                   "address1" => "Kraanspoor",
50 |                   "address2" => "",
51 |                   "house_number" => "39",
52 |                   "zip_code" => "1032 SC",
53 |                   "city" => "Amsterdam",
54 |                   "state" => "",
55 |                   "country" => "NL",
56 |                   "phone" => "0208500500",
57 |                   "email" => "test@test.nl",
58 |               ),
59 |               "google_analytics" => array(
60 |                   "account" => "UA-XXXXXXXXX",
61 |               ),
62 |               "plugin" => array(
63 |                   "shop" => "ideal demo",
64 |                   "shop_version" => "1.0.0",
65 |                   "plugin_version" => "1.0.1",
66 |                   "partner" => "MultiSafepay",
67 |                   "shop_root_url" => "http://www.demo.nl",
68 |               ),
69 |               "custom_info" => array(
70 |                   "custom_1" => "value1",
71 |                   "custom_2" => "value2",
72 |               )
73 |           );
74 | print_r($order);?>
75 | 						
76 |         
77 |

The JSON request would then be:

78 |
79 |
80 | 81 |
82 |

You can click here to return to the MultiSafepay toolkit

83 | 84 |
85 |
86 | 87 |
88 |
89 |
90 |
91 | 99 |
-------------------------------------------------------------------------------- /controllers/gatewayController.php: -------------------------------------------------------------------------------- 1 | startTransaction($_GET['gateway']); 18 | } 19 | 20 | class gatewayController { 21 | 22 | private $api_key = ''; 23 | private $api_url = ''; 24 | 25 | function __construct() { 26 | $this->api_key = API_KEY; 27 | $this->api_url = API_URL; 28 | } 29 | 30 | function getGateways() { 31 | $msp = new \MultiSafepayAPI\Client; 32 | $msp->setApiKey($this->api_key); 33 | $msp->setApiUrl($this->api_url); 34 | try { 35 | $query_string = 'country=NL¤cy=USD&amount=1000&locale=nl-NL'; 36 | 37 | 38 | $gateways = $msp->gateways->get($endpoint = 'gateways', $type = '', array(), $query_string); 39 | } catch (Exception $e) { 40 | echo "Error " . htmlspecialchars($e->getMessage()); 41 | } 42 | 43 | //Create an example gateway selection for forms 44 | $selection = '"; 51 | 52 | return $selection; 53 | } 54 | 55 | function startTransaction($gateway) { 56 | $msp = new \MultiSafepayAPI\Client; 57 | $msp->setApiKey($this->api_key); 58 | $msp->setApiUrl($this->api_url); 59 | 60 | try { 61 | $order_id = time(); 62 | 63 | $order = $msp->orders->post(array( 64 | "type" => "redirect", 65 | "order_id" => $order_id, 66 | "currency" => "EUR", 67 | "amount" => 1000, 68 | "description" => "Demo Transaction", 69 | "var1" => "1", 70 | "var2" => "2", 71 | "var3" => "3", 72 | "items" => "items list", 73 | "manual" => "false", 74 | "gateway" => $gateway, 75 | "days_active" => "30", 76 | "payment_options" => array( 77 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 78 | "redirect_url" => BASE_URL . "mainController.php", 79 | "cancel_url" => BASE_URL . 'cancelController.php', 80 | "close_window" => "true" 81 | ), 82 | "customer" => array( 83 | "locale" => "nl_NL", 84 | "ip_address" => "127.0.0.1", 85 | "forwarded_ip" => "127.0.0.1", 86 | "first_name" => "Jan", 87 | "last_name" => "Modaal", 88 | "address1" => "Kraanspoor", 89 | "address2" => "", 90 | "house_number" => "39", 91 | "zip_code" => "1032 SC", 92 | "city" => "Amsterdam", 93 | "state" => "", 94 | "country" => "NL", 95 | "phone" => "0208500500", 96 | "email" => "test@test.nl", 97 | ), 98 | "google_analytics" => array( 99 | "account" => "UA-XXXXXXXXX", 100 | ), 101 | "plugin" => array( 102 | "shop" => "ideal demo", 103 | "shop_version" => "1.0.0", 104 | "plugin_version" => "1.0.1", 105 | "partner" => "MultiSafepay", 106 | "shop_root_url" => "http://www.demo.nl", 107 | ), 108 | "custom_info" => array( 109 | "custom_1" => "value1", 110 | "custom_2" => "value2", 111 | ) 112 | )); 113 | 114 | header("Location: " . $msp->orders->getPaymentLink()); 115 | } catch (Exception $e) { 116 | echo "Error " . htmlspecialchars($e->getMessage()); 117 | } 118 | } 119 | 120 | } 121 | 122 | ?> -------------------------------------------------------------------------------- /controllers/klarnaController.php: -------------------------------------------------------------------------------- 1 | startTransaction(); 12 | 13 | class klarnaController { 14 | 15 | private $api_key = ''; 16 | private $api_url = ''; 17 | 18 | function __construct() { 19 | $this->api_key = API_KEY; 20 | $this->api_url = API_URL; 21 | } 22 | 23 | function startTransaction() { 24 | $msp = new \MultiSafepayAPI\Client; 25 | $msp->setApiKey($this->api_key); 26 | $msp->setApiUrl($this->api_url); 27 | try { 28 | $order_id = time(); 29 | $order = $msp->orders->post(array( 30 | "type" => "redirect", 31 | "order_id" => $order_id, 32 | "currency" => "EUR", 33 | "amount" => 2000, 34 | "description" => "Demo Transaction", 35 | "var1" => "", 36 | "var2" => "", 37 | "var3" => "", 38 | "items" => "items list", 39 | "manual" => "false", 40 | "gateway" => "KLARNA", 41 | "days_active" => "30", 42 | "payment_options" => array( 43 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 44 | "redirect_url" => BASE_URL . "mainController.php?view=klarnaComplete", 45 | "cancel_url" => BASE_URL . 'cancelController.php', 46 | "close_window" => "true" 47 | ), 48 | "customer" => array( 49 | "locale" => "nl_NL", 50 | "ip_address" => "127.0.0.1", 51 | "forwarded_ip" => "127.0.0.1", 52 | "first_name" => "Testperson-nl", 53 | "last_name" => "Approved", 54 | "address1" => "Neherkade", 55 | "address2" => "", 56 | "house_number" => "1 XI", 57 | "zip_code" => "2521VA", 58 | "city" => "Gravenhage", 59 | "state" => "Zuid holland", 60 | "country" => "NL", 61 | "phone" => "0612345678", 62 | "email" => "test@test.nl", 63 | ), 64 | "gateway_info" => array( 65 | "birthday" => "10071970", 66 | "bank_account" => "", 67 | "phone" => "0612345678", 68 | "referrer" => "http://google.nl", 69 | "user_agent" => "msp01", 70 | "gender" => "male", 71 | "email" => "test@test.nl", 72 | ), 73 | "shopping_cart" => array( 74 | "items" => array( 75 | array( 76 | "name" => "Test", 77 | "description" => "", 78 | "unit_price" => "10", 79 | "quantity" => "2", 80 | "merchant_item_id" => "test123", 81 | "tax_table_selector" => "BTW0", 82 | "weight" => array( 83 | "unit" => "KB", 84 | "value" => "20", 85 | ) 86 | ) 87 | ) 88 | ), 89 | "checkout_options" => array( 90 | "tax_tables" => array( 91 | "default" => array( 92 | "shipping_taxed" => "true", 93 | "rate" => "0.21" 94 | ), 95 | "alternate" => array( 96 | array( 97 | "standalone" => "true", 98 | "name" => "BTW0", 99 | "rules" => array( 100 | array("rate" => "0.00") 101 | ), 102 | ) 103 | ) 104 | ) 105 | ), 106 | "plugin" => array( 107 | "shop" => "MultiSafepay Toolkit", 108 | "shop_version" => TOOLKIT_VERSION, 109 | "plugin_version" => TOOLKIT_VERSION, 110 | "partner" => "MultiSafepay", 111 | "shop_root_url" => "http://www.demo.nl", 112 | ) 113 | )); 114 | 115 | header("Location: " . $msp->orders->getPaymentLink()); 116 | } catch (Exception $e) { 117 | echo "Error " . htmlspecialchars($e->getMessage()); 118 | } 119 | } 120 | 121 | } 122 | 123 | ?> -------------------------------------------------------------------------------- /views/idealComplete.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

You transaction has been processed, if your payment was successful then you can start processing the order.

17 |
18 |

You had selected the direct iDEAL example, first an iDEAL issuer request was done on the following url (with correct header settings):

19 |
20 |
https://testapi.multisafepay.com/v1/json/issuers/ideal
21 | 22 |
23 |

24 | The response would then be: 25 |

26 |
27 |
stdClass Object
 28 | (
 29 |     [success] => 1
 30 |     [data] => Array
 31 |     (
 32 |         [0] => stdClass Object
 33 |         (
 34 |           [code] => 3151
 35 |           [description] => Test bank
 36 |         )
 37 |     )
 38 | )
 39 |         
40 | 41 |

this transaction was requested using the following data (example):

42 |
43 |
 "direct",
 48 |               "order_id" => $order_id,
 49 |               "currency" => "EUR",
 50 |               "amount" => 1000,
 51 |               "description" => "Demo Transaction",
 52 |               "var1" => "1",
 53 |               "var2" => "2",
 54 |               "var3" => "3",
 55 |               "items" => "items list",
 56 |               "manual" => "false",
 57 |               "gateway" => "IDEAL",
 58 |               "days_active" => "30",
 59 |               "payment_options" => array(
 60 |                   "notification_url" => BASE_URL . "notificationController.php?type=initial",
 61 |                   "redirect_url" => BASE_URL . "mainController.php?view=idealComplete",
 62 |                   "cancel_url" => BASE_URL . 'cancelController.php',
 63 |                   "close_window" => "true"
 64 |               ),
 65 |               "customer" => array(
 66 |                   "locale" => "nl_NL",
 67 |                   "ip_address" => "127.0.0.1",
 68 |                   "forwarded_ip" => "127.0.0.1",
 69 |                   "first_name" => "Jan",
 70 |                   "last_name" => "Modaal",
 71 |                   "address1" => "Kraanspoor",
 72 |                   "address2" => "",
 73 |                   "house_number" => "39",
 74 |                   "zip_code" => "1032 SC",
 75 |                   "city" => "Amsterdam",
 76 |                   "state" => "",
 77 |                   "country" => "NL",
 78 |                   "phone" => "0208500500",
 79 |                   "email" => "test@test.nl",
 80 |               ),
 81 |               "gateway_info" => array(
 82 |                   "issuer_id" => '3151',
 83 |               ),
 84 |               "plugin" => array(
 85 |                   "shop" => "ideal demo",
 86 |                   "shop_version" => "1.0.0",
 87 |                   "plugin_version" => "1.0.1",
 88 |                   "partner" => "MultiSafepay",
 89 |                   "shop_root_url" => "http://www.demo.nl",
 90 |               )
 91 |           );
 92 | 
 93 |           print_r($order);
 94 |           ?>
 95 | 			
 96 |         
97 |

The JSON request would then be:

98 |
99 |
100 | 101 |
102 |

You can click here to return to the MultiSafepay toolkit

103 |
104 | 105 |
106 |
107 | 108 |
109 |
110 |
111 |
112 | 120 |
-------------------------------------------------------------------------------- /controllers/payafterdeliveryController.php: -------------------------------------------------------------------------------- 1 | startTransaction(); 12 | 13 | class payafterDeliveryController { 14 | 15 | private $api_key = ''; 16 | private $api_url = ''; 17 | 18 | function __construct() { 19 | $this->api_key = API_KEY; 20 | $this->api_url = API_URL; 21 | } 22 | 23 | function startTransaction() { 24 | $msp = new \MultiSafepayAPI\Client; 25 | $msp->setApiKey($this->api_key); 26 | $msp->setApiUrl($this->api_url); 27 | try { 28 | $order_id = time(); 29 | $order = $msp->orders->post(array( 30 | "type" => "direct", 31 | "order_id" => $order_id, 32 | "currency" => "EUR", 33 | "amount" => 2000, 34 | "description" => "Demo Transaction", 35 | "var1" => "", 36 | "var2" => "", 37 | "var3" => "", 38 | "items" => "items list", 39 | "manual" => "false", 40 | "gateway" => "PAYAFTER", 41 | "days_active" => "30", 42 | "payment_options" => array( 43 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 44 | "redirect_url" => BASE_URL . "mainController.php", 45 | "cancel_url" => BASE_URL . 'cancelController.php', 46 | "close_window" => "true" 47 | ), 48 | "customer" => array( 49 | "locale" => "nl_NL", 50 | "ip_address" => "127.0.0.1", 51 | "forwarded_ip" => "127.0.0.1", 52 | "first_name" => "Jan", 53 | "last_name" => "Modaal", 54 | "address1" => "Kraanspoor", 55 | "address2" => "", 56 | "house_number" => "39", 57 | "zip_code" => "1033 SC", 58 | "city" => "Amsterdam", 59 | "state" => "", 60 | "country" => "NL", 61 | "phone" => "0208500500", 62 | "email" => "test@test.nl", 63 | ), 64 | "gateway_info" => array( 65 | "birthday" => "1980-01-30", 66 | "bank_account" => "2884455", 67 | "phone" => "0208500500", 68 | "referrer" => "http://google.nl", 69 | "user_agent" => "msp01", 70 | "email" => "test@test.nl" 71 | ), 72 | "shopping_cart" => array( 73 | "items" => array( 74 | array( 75 | "name" => "Test", 76 | "description" => "", 77 | "unit_price" => "10", 78 | "quantity" => "2", 79 | "merchant_item_id" => "test123", 80 | "tax_table_selector" => "BTW0", 81 | "weight" => array( 82 | "unit" => "KB", 83 | "value" => "20", 84 | ) 85 | ) 86 | ) 87 | ), 88 | "checkout_options" => array( 89 | "tax_tables" => array( 90 | "default" => array( 91 | "shipping_taxed" => "true", 92 | "rate" => "0.21" 93 | ), 94 | "alternate" => array( 95 | array( 96 | "standalone" => "true", 97 | "name" => "BTW0", 98 | "rules" => array( 99 | array("rate" => "0.00") 100 | ), 101 | ) 102 | ) 103 | ) 104 | ), 105 | "plugin" => array( 106 | "shop" => "MultiSafepay Toolkit", 107 | "shop_version" => TOOLKIT_VERSION, 108 | "plugin_version" => TOOLKIT_VERSION, 109 | "partner" => "MultiSafepay", 110 | "shop_root_url" => "http://www.demo.nl", 111 | ) 112 | )); 113 | 114 | if ($msp->orders->result->success) { 115 | $return_url = substr(BASE_URL, 0, -12) . 'index.php?view=payafterComplete'; 116 | 117 | header("Location: " . $return_url); 118 | } 119 | } catch (Exception $e) { 120 | echo "Error " . htmlspecialchars($e->getMessage()); 121 | } 122 | } 123 | 124 | } 125 | 126 | ?> -------------------------------------------------------------------------------- /controllers/refundController.php: -------------------------------------------------------------------------------- 1 | startTransaction($_GET['issuer']); 18 | } elseif (isset($_GET['task'])) { 19 | 20 | if ($_GET['task'] == 'refund') { 21 | $refund->loadRefundView(); 22 | } else { 23 | $refund->doRefund(); 24 | } 25 | } 26 | 27 | class refundController { 28 | 29 | private $api_key = ''; 30 | private $api_url = ''; 31 | 32 | function __construct() { 33 | $this->api_key = API_KEY; 34 | $this->api_url = API_URL; 35 | } 36 | 37 | function startTransaction($issuer) { 38 | $msp = new \MultiSafepayAPI\Client; 39 | $msp->setApiKey($this->api_key); 40 | $msp->setApiUrl($this->api_url); 41 | 42 | try { 43 | $order_id = time(); 44 | 45 | $order = $msp->orders->post(array( 46 | "type" => "direct", 47 | "order_id" => $order_id, 48 | "currency" => "EUR", 49 | "amount" => 1000, 50 | "description" => "Demo Transaction", 51 | "var1" => "1", 52 | "var2" => "2", 53 | "var3" => "3", 54 | "items" => "items list", 55 | "manual" => "false", 56 | "gateway" => "IDEAL", 57 | "days_active" => "30", 58 | "payment_options" => array( 59 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 60 | "redirect_url" => BASE_URL . "refundController.php?task=refund", 61 | "cancel_url" => BASE_URL . 'cancelController.php', 62 | "close_window" => "true" 63 | ), 64 | "customer" => array( 65 | "locale" => "nl_NL", 66 | "ip_address" => "127.0.0.1", 67 | "forwarded_ip" => "127.0.0.1", 68 | "first_name" => "Jan", 69 | "last_name" => "Modaal", 70 | "address1" => "Kraanspoor", 71 | "address2" => "", 72 | "house_number" => "39", 73 | "zip_code" => "1032 SC", 74 | "city" => "Amsterdam", 75 | "state" => "", 76 | "country" => "NL", 77 | "phone" => "0208500500", 78 | "email" => "test@test.nl", 79 | ), 80 | "gateway_info" => array( 81 | "issuer_id" => $issuer, 82 | ), 83 | "plugin" => array( 84 | "shop" => "MultiSafepay Toolkit", 85 | "shop_version" => TOOLKIT_VERSION, 86 | "plugin_version" => TOOLKIT_VERSION, 87 | "partner" => "MultiSafepay", 88 | "shop_root_url" => "http://www.demo.nl", 89 | ) 90 | )); 91 | 92 | header("Location: " . $msp->orders->getPaymentLink()); 93 | } catch (Exception $e) { 94 | echo "Error " . htmlspecialchars($e->getMessage()); 95 | } 96 | } 97 | 98 | public function loadRefundView() { 99 | $return_url = substr(BASE_URL, 0, -12) . 'index.php?view=refund&transactionid=' . $_GET['transactionid']; 100 | 101 | header("location: " . $return_url); 102 | } 103 | 104 | public function doRefund() { 105 | 106 | $msp = new \MultiSafepayAPI\Client; 107 | $msp->setApiKey($this->api_key); 108 | $msp->setApiUrl($this->api_url); 109 | 110 | $transactionid = $_GET['transactionid']; 111 | 112 | //get the order status 113 | $order = $msp->orders->get($type = 'orders', $transactionid, $body = array(), $query_string = false); 114 | 115 | 116 | if ($order->status == "completed") { 117 | //the transaction status was competed, now we will refund the transaction 118 | $endpoint = 'orders/' . $transactionid . '/refunds'; 119 | try { 120 | $order = $msp->orders->post(array( 121 | "type" => "refund", 122 | "amount" => "20", 123 | "currency" => "EUR", 124 | "description" => "PHP Wrapper Toolkit Refund", 125 | ), $endpoint); 126 | } catch (Exception $e) { 127 | echo "Error " . htmlspecialchars($e->getMessage()); 128 | } 129 | } 130 | $return_url = substr(BASE_URL, 0, -12) . 'index.php?view=refundComplete'; 131 | 132 | header("location: " . $return_url); 133 | } 134 | 135 | } 136 | 137 | ?> -------------------------------------------------------------------------------- /views/content.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

This toolkit demonstrates all MultiSafepay API calls and explains how they work.


14 |

How it works:

15 |

You can click on the function of your choice. When you are testing normal transaction like Connect, FastCheckout, iDEAL etc, then you will go through the payment process, if additional information is needed then this will be requested. For direct iDEAL we will show you an issuer selection like how it can be added to your webshop.

16 |


Whenever you want to test a function that isn't a "transaction" but a change of a transaction etc, then first you will go through the transaction process so you can simulate the requested function onto that transaction. Like, refunding, updating etc of the transaction

17 |
18 | 35 |
36 |

Authentication

37 |

38 | All requests to the MultiSafepay API require authentication. Authentication is provided by including an API Key as an HTTP header in your request. Each website has it's own API Key so if you are operating multiple websites be sure to use the correct API Key for each site. The API Key can be found under the website settings in MultiSafepay Control.
39 |
The HTTP header name for the API Key is: api_key 40 |

41 |
42 |

Code Examples

43 |

44 | Whenever you want to start building your own MultiSafepay integration then you can use the examples within this Toolkit as your base. Within the "Models" folder you can find our API code that is used to communicatie with our payment servers. 45 |
46 | You can also take a closer look at the controllers within the controllers folder. The following controllers are being used for some specific API calls. 47 |
48 |

    49 |
  1. connectController.php
  2. 50 |
  3. fastcheckoutController.php
  4. 51 |
  5. idealController.php
  6. 52 |
  7. gatewayController.php
  8. 53 |
  9. refundController.php
  10. 54 |
  11. payafterdeliveryController.php
  12. 55 |
  13. klarnaController.php
  14. 56 |
  15. updateController.php
  16. 57 |
  17. detailsController.php
  18. 58 |
  19. splitpaymentController.php
  20. 59 |
  21. recurringController.php
  22. 60 | 61 |
62 |
63 |

64 | 65 |
66 |
67 |
68 | 76 |
-------------------------------------------------------------------------------- /views/klarnaComplete.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

Your Klarna transaction has been processed, you can now start the order processing

17 |
18 |

You had selected the Klarna example, this transaction was requested using the following data (example):

19 |
20 |
 "redirect",
 25 |               "order_id" => $order_id,
 26 |               "currency" => "EUR",
 27 |               "amount" => 2000,
 28 |               "description" => "Demo Transaction",
 29 |               "var1" => "",
 30 |               "var2" => "",
 31 |               "var3" => "",
 32 |               "items" => "items list",
 33 |               "manual" => "false",
 34 |               "gateway" => "KLARNA",
 35 |               "days_active" => "30",
 36 |               "payment_options" => array(
 37 |                   "notification_url" => BASE_URL . "notificationController.php?type=initial",
 38 |                   "redirect_url" => BASE_URL . "mainController.php?view=klarnaComplete",
 39 |                   "cancel_url" => BASE_URL . 'cancelController.php',
 40 |                   "close_window" => "true"
 41 |               ),
 42 |               "customer" => array(
 43 |                   "locale" => "nl_NL",
 44 |                   "ip_address" => "127.0.0.1",
 45 |                   "forwarded_ip" => "127.0.0.1",
 46 |                   "first_name" => "Testperson-nl",
 47 |                   "last_name" => "Approved",
 48 |                   "address1" => "Neherkade",
 49 |                   "address2" => "",
 50 |                   "house_number" => "1 XI",
 51 |                   "zip_code" => "2521VA",
 52 |                   "city" => "Gravenhage",
 53 |                   "state" => "Zuid holland",
 54 |                   "country" => "NL",
 55 |                   "phone" => "0612345678",
 56 |                   "email" => "info@test.com",
 57 |               ),
 58 |               "gateway_info" => array(
 59 |                   "birthday" => "10071970",
 60 |                   "bank_account" => "",
 61 |                   "phone" => "0612345678",
 62 |                   "referrer" => "http://google.nl",
 63 |                   "user_agent" => "msp01",
 64 |                   "gender" => "male",
 65 |                   "email" => "info@test.com",
 66 |               ),
 67 |               "shopping_cart" => array(
 68 |                   "items" => array(
 69 |                       array(
 70 |                           "name" => "Test",
 71 |                           "description" => "",
 72 |                           "unit_price" => "10",
 73 |                           "quantity" => "2",
 74 |                           "merchant_item_id" => "test123",
 75 |                           "tax_table_selector" => "BTW0",
 76 |                           "weight" => array(
 77 |                               "unit" => "KB",
 78 |                               "value" => "20",
 79 |                           )
 80 |                       )
 81 |                   )
 82 |               ),
 83 |               "checkout_options" => array(
 84 |                   "tax_tables" => array(
 85 |                       "default" => array(
 86 |                           "shipping_taxed" => "true",
 87 |                           "rate" => "0.21"
 88 |                       ),
 89 |                       "alternate" => array(
 90 |                           array(
 91 |                               "standalone" => "true",
 92 |                               "name" => "BTW0",
 93 |                               "rules" => array(
 94 |                                   array("rate" => "0.00")
 95 |                               ),
 96 |                           )
 97 |                       )
 98 |                   )
 99 |               ),
100 |               "plugin" => array(
101 |                   "shop" => "ideal demo",
102 |                   "shop_version" => "1.0.0",
103 |                   "plugin_version" => "1.0.1",
104 |                   "partner" => "MultiSafepay",
105 |                   "shop_root_url" => "http://www.demo.nl",
106 |               )
107 |           );
108 |           print_r($order);
109 |           ?>
110 |

The JSON request would then be:

111 |
112 |
113 | 114 |
115 | 116 |

You can click here to return to the MultiSafepay toolkit

117 |
118 |
119 |
120 | 121 |
122 |
123 |
124 |
125 | 133 |
-------------------------------------------------------------------------------- /controllers/fastcheckoutController.php: -------------------------------------------------------------------------------- 1 | startTransaction(); 11 | 12 | class fastcheckoutController { 13 | 14 | private $api_key = ''; 15 | private $api_url = ''; 16 | 17 | function __construct() { 18 | $this->api_key = API_KEY; 19 | $this->api_url = API_URL; 20 | } 21 | 22 | function startTransaction() { 23 | $msp = new \MultiSafepayAPI\Client; 24 | $msp->setApiKey($this->api_key); 25 | $msp->setApiUrl($this->api_url); 26 | try { 27 | $order_id = time(); 28 | 29 | $order = $msp->orders->post(array( 30 | "type" => "checkout", 31 | "order_id" => $order_id, 32 | "currency" => "EUR", 33 | "amount" => 2000, 34 | "description" => "Demo Transaction", 35 | "var1" => "", 36 | "var2" => "", 37 | "var3" => "", 38 | "items" => "items list", 39 | "manual" => "false", 40 | "gateway" => "", 41 | "days_active" => "30", 42 | "payment_options" => array( 43 | "notification_url" => BASE_URL . "notificationController.php?type=initial", 44 | "redirect_url" => BASE_URL . "mainController.php?view=fastcheckoutComplete", 45 | "cancel_url" => BASE_URL . 'cancelController.php', 46 | "close_window" => "true" 47 | ), 48 | "customer" => array( 49 | "locale" => "nl_NL", 50 | "ip_address" => "127.0.0.1", 51 | "forwarded_ip" => "127.0.0.1", 52 | "first_name" => "Jan", 53 | "last_name" => "Modaal", 54 | "address1" => "Kraanspoor", 55 | "address2" => "", 56 | "house_number" => "39", 57 | "zip_code" => "1032 SC", 58 | "city" => "Amsterdam", 59 | "state" => "", 60 | "country" => "NL", 61 | "phone" => "0208500500", 62 | "email" => "test@test.nl", 63 | ), 64 | "gateway_info" => array( 65 | "birthday" => "1980-01-30", 66 | "bank_account" => "2884455", 67 | "phone" => "0208500500", 68 | "referrer" => "http://google.nl", 69 | "user_agent" => "msp01", 70 | ), 71 | "shopping_cart" => array( 72 | "items" => array( 73 | array( 74 | "name" => "Test", 75 | "description" => "", 76 | "unit_price" => "10", 77 | "quantity" => "2", 78 | "merchant_item_id" => "test123", 79 | "tax_table_selector" => "BTW0", 80 | "weight" => array( 81 | "unit" => "KB", 82 | "value" => "20", 83 | ) 84 | ) 85 | ) 86 | ), 87 | "checkout_options" => array( 88 | "no-shipping-methods" => false, 89 | "shipping_methods" => array( 90 | "flat_rate_shipping" => array( 91 | array( 92 | "name" => "Post Nl - verzending NL", 93 | "price" => "7", 94 | "currency" => "", 95 | "allowed_areas" => array( 96 | "NL" 97 | ), 98 | ), array( 99 | "name" => "TNT verzending", 100 | "price" => "9", 101 | "excluded_areas" => array( 102 | "NL", "FR", "ES" 103 | ) 104 | ) 105 | ), 106 | "pickup" => array( 107 | "name" => "Ophalen", 108 | "price" => "0", 109 | ) 110 | ), 111 | "tax_tables" => array( 112 | "default" => array( 113 | "shipping_taxed" => "true", 114 | "rate" => "0.21" 115 | ), 116 | "alternate" => array( 117 | array( 118 | "standalone" => "true", 119 | "name" => "BTW0", 120 | "rules" => array( 121 | array("rate" => "0.00") 122 | ), 123 | ) 124 | ) 125 | ) 126 | ), 127 | "custom_fields" => array( 128 | array( 129 | "standard_type" => "birthday", 130 | ), 131 | array( 132 | "standard_type" => "companyname", 133 | ) 134 | ), 135 | "plugin" => array( 136 | "shop" => "MultiSafepay Toolkit", 137 | "shop_version" => TOOLKIT_VERSION, 138 | "plugin_version" => TOOLKIT_VERSION, 139 | "partner" => "MultiSafepay", 140 | "shop_root_url" => "http://www.demo.nl", 141 | ) 142 | )); 143 | 144 | header("Location: " . $msp->orders->getPaymentLink()); 145 | } catch (Exception $e) { 146 | echo "Error " . htmlspecialchars($e->getMessage()); 147 | } 148 | } 149 | 150 | } 151 | 152 | ?> -------------------------------------------------------------------------------- /views/payafterComplete.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

Your Pay After Delivery transaction has been processed, you can now start the order processing

17 |
18 |

When using Pay After Delivery like is done with this example then all data of the consumer is provided with the Transaction request, this means MultiSafepay doesn't show an 19 | extra page requesting for more information. Because all information was added to the transaction request, MultiSafepay can validate it and when there are issues then an error is returned and can be shown within your webshop. 20 |

21 |
22 | 23 |

You had selected the Pay After Delivery example, this transaction was requested using the following data (example):

24 |
25 |
 "direct",
 30 |               "order_id" => $order_id,
 31 |               "currency" => "EUR",
 32 |               "amount" => 2000,
 33 |               "description" => "Demo Transaction",
 34 |               "var1" => "",
 35 |               "var2" => "",
 36 |               "var3" => "",
 37 |               "items" => "items list",
 38 |               "manual" => "false",
 39 |               "gateway" => "PAYAFTER",
 40 |               "days_active" => "30",
 41 |               "payment_options" => array(
 42 |                   "notification_url" => BASE_URL . "notificationController.php?type=initial",
 43 |                   "redirect_url" => BASE_URL . "mainController.php",
 44 |                   "cancel_url" => BASE_URL . 'cancelController.php',
 45 |                   "close_window" => "true"
 46 |               ),
 47 |               "customer" => array(
 48 |                   "locale" => "nl_NL",
 49 |                   "ip_address" => "127.0.0.1",
 50 |                   "forwarded_ip" => "127.0.0.1",
 51 |                   "first_name" => "Jan",
 52 |                   "last_name" => "Modaal",
 53 |                   "address1" => "Kraanspoor",
 54 |                   "address2" => "",
 55 |                   "house_number" => "39",
 56 |                   "zip_code" => "1033 SC",
 57 |                   "city" => "Amsterdam",
 58 |                   "state" => "",
 59 |                   "country" => "NL",
 60 |                   "phone" => "0208500500",
 61 |                   "email" => "test@test.nl",
 62 |               ),
 63 |               "gateway_info" => array(
 64 |                   "birthday" => "1980-01-30",
 65 |                   "bank_account" => "2884455",
 66 |                   "phone" => "0208500500",
 67 |                   "referrer" => "http://google.nl",
 68 |                   "user_agent" => "msp01",
 69 |                   "email" => "test@test.nl"
 70 |               ),
 71 |               "shopping_cart" => array(
 72 |                   "items" => array(
 73 |                       array(
 74 |                           "name" => "Test",
 75 |                           "description" => "",
 76 |                           "unit_price" => "10",
 77 |                           "quantity" => "2",
 78 |                           "merchant_item_id" => "test123",
 79 |                           "tax_table_selector" => "BTW0",
 80 |                           "weight" => array(
 81 |                               "unit" => "KB",
 82 |                               "value" => "20",
 83 |                           )
 84 |                       )
 85 |                   )
 86 |               ),
 87 |               "checkout_options" => array(
 88 |                   "tax_tables" => array(
 89 |                       "default" => array(
 90 |                           "shipping_taxed" => "true",
 91 |                           "rate" => "0.21"
 92 |                       ),
 93 |                       "alternate" => array(
 94 |                           array(
 95 |                               "standalone" => "true",
 96 |                               "name" => "BTW0",
 97 |                               "rules" => array(
 98 |                                   array("rate" => "0.00")
 99 |                               ),
100 |                           )
101 |                       )
102 |                   )
103 |               ),
104 |               "plugin" => array(
105 |                   "shop" => "ideal demo",
106 |                   "shop_version" => "1.0.0",
107 |                   "plugin_version" => "1.0.1",
108 |                   "partner" => "MultiSafepay",
109 |                   "shop_root_url" => "http://www.demo.nl",
110 |               )
111 |           );
112 | 
113 |           print_r($order);
114 |           ?>
115 |

The JSON request would then be:

116 |
117 |
118 | 119 |
120 |

You can click here to return to the MultiSafepay toolkit

121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |
129 | 137 |
-------------------------------------------------------------------------------- /views/fastcheckoutComplete.php: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 |
12 |
13 |

Thank you for your order.

14 |
15 | 16 |

You transaction has been processed, if your payment was successful then you can start processing the order.

17 |
18 | 19 |

You had selected the FastCheckout example, this transaction was requested using the following data (example):

20 |
21 |
 "checkout",
 26 |               "order_id" => $order_id,
 27 |               "currency" => "EUR",
 28 |               "amount" => 2000,
 29 |               "description" => "Demo Transaction",
 30 |               "var1" => "",
 31 |               "var2" => "",
 32 |               "var3" => "",
 33 |               "items" => "items list",
 34 |               "manual" => "false",
 35 |               "gateway" => "",
 36 |               "days_active" => "30",
 37 |               "payment_options" => array(
 38 |                   "notification_url" => BASE_URL . "notificationController.php?type=initial",
 39 |                   "redirect_url" => BASE_URL . "mainController.php?view=fastcheckoutComplete",
 40 |                   "cancel_url" => BASE_URL . 'cancelController.php',
 41 |                   "close_window" => "true"
 42 |               ),
 43 |               "customer" => array(
 44 |                   "locale" => "nl_NL",
 45 |                   "ip_address" => "127.0.0.1",
 46 |                   "forwarded_ip" => "127.0.0.1",
 47 |                   "first_name" => "Jan",
 48 |                   "last_name" => "Modaal",
 49 |                   "address1" => "Kraanspoor",
 50 |                   "address2" => "",
 51 |                   "house_number" => "39",
 52 |                   "zip_code" => "1032 SC",
 53 |                   "city" => "Amsterdam",
 54 |                   "state" => "",
 55 |                   "country" => "NL",
 56 |                   "phone" => "0208500500",
 57 |                   "email" => "test@test.nl",
 58 |               ),
 59 |               "gateway_info" => array(
 60 |                   "birthday" => "1980-01-30",
 61 |                   "bank_account" => "2884455",
 62 |                   "phone" => "0208500500",
 63 |                   "referrer" => "http://google.nl",
 64 |                   "user_agent" => "msp01",
 65 |               ),
 66 |               "shopping_cart" => array(
 67 |                   "items" => array(
 68 |                       array(
 69 |                           "name" => "Test",
 70 |                           "description" => "",
 71 |                           "unit_price" => "10",
 72 |                           "quantity" => "2",
 73 |                           "merchant_item_id" => "test123",
 74 |                           "tax_table_selector" => "BTW0",
 75 |                           "weight" => array(
 76 |                               "unit" => "KB",
 77 |                               "value" => "20",
 78 |                           )
 79 |                       )
 80 |                   )
 81 |               ),
 82 |               "checkout_options" => array(
 83 |                   "no-shipping-methods" => false,
 84 |                   "shipping_methods" => array(
 85 |                       "flat_rate_shipping" => array(
 86 |                           array(
 87 |                               "name" => "Post Nl - verzending NL",
 88 |                               "price" => "7",
 89 |                               "currency" => "",
 90 |                               "allowed_areas" => array(
 91 |                                   "NL"
 92 |                               ),
 93 |                           ), array(
 94 |                               "name" => "TNT verzending",
 95 |                               "price" => "9",
 96 |                               "excluded_areas" => array(
 97 |                                   "NL", "FR", "ES"
 98 |                               )
 99 |                           )
100 |                       ),
101 |                       "pickup" => array(
102 |                           "name" => "Ophalen",
103 |                           "price" => "0",
104 |                       )
105 |                   ),
106 |                   "tax_tables" => array(
107 |                       "default" => array(
108 |                           "shipping_taxed" => "true",
109 |                           "rate" => "0.21"
110 |                       ),
111 |                       "alternate" => array(
112 |                           array(
113 |                               "standalone" => "true",
114 |                               "name" => "BTW0",
115 |                               "rules" => array(
116 |                                   array("rate" => "0.00")
117 |                               ),
118 |                           )
119 |                       )
120 |                   )
121 |               ),
122 |               "custom_fields" => array(
123 |                   array(
124 |                       "standard_type" => "birthday",
125 |                   ),
126 |                   array(
127 |                       "standard_type" => "companyname",
128 |                   )
129 |               ),
130 |               "plugin" => array(
131 |                   "shop" => "ideal demo",
132 |                   "shop_version" => "1.0.0",
133 |                   "plugin_version" => "1.0.1",
134 |                   "partner" => "MultiSafepay",
135 |                   "shop_root_url" => "http://www.demo.nl",
136 |               )
137 |           );
138 | 
139 |           print_r($order);
140 |           ?>
141 |

The JSON request would then be:

142 |
143 |
144 | 145 |
146 |

You can click here to return to the MultiSafepay toolkit

147 |
148 | 149 |
150 |
151 | 152 |
153 |
154 |
155 |
156 | 164 |
-------------------------------------------------------------------------------- /assets/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | body, a{ 4 | color: #7b7b7b; 5 | font-size: 14.5px; 6 | line-height: 25px; 7 | letter-spacing: 0.25px; 8 | text-align: left; 9 | } 10 | 11 | * { 12 | font-family: 'Open Sans',Arial,sans-serif; 13 | padding: 0; 14 | margin: 0; 15 | border: 0; 16 | text-decoration: none; 17 | } 18 | ul{ 19 | list-style-type: none; 20 | } 21 | 22 | #logo { 23 | float: left; 24 | } 25 | 26 | .logo { 27 | height: 30px; 28 | padding: 10px 10px 10px 0px; 29 | } 30 | 31 | #container { 32 | margin:0 auto; 33 | max-width: 960px; 34 | } 35 | 36 | div#main-menu { 37 | padding-top: 5px; 38 | background-color: #006693; 39 | -webkit-transition: all 0.3s ease; 40 | -moz-transition: all 0.3s ease; 41 | -ms-transition: all 0.3s ease; 42 | -o-transition: all 0.3s ease; 43 | transition: all 0.3s ease; 44 | } 45 | div#main-menu form { 46 | float: left; 47 | } 48 | ul#main-menu li { 49 | padding: 15px; 50 | float: left; 51 | line-height: 20px; 52 | } 53 | 54 | div#main-menu * { 55 | color: #fff; 56 | } 57 | div#main-menu form { 58 | padding: 10px; 59 | float: right; 60 | } 61 | 62 | input.search { 63 | background: none; 64 | box-shadow: none; 65 | border: none; 66 | outline: none; 67 | color: #fff; 68 | padding: 6px 12px; 69 | font-size: 14px; 70 | line-height: 1.42857143; 71 | width: 0px; 72 | } 73 | ::-webkit-input-placeholder { color: #fff; } 74 | ::-moz-placeholder { color: #fff; } 75 | :-ms-input-placeholder { color: #fff; } 76 | input.search:-moz-placeholder { color: #fff; } 77 | 78 | #main-wrapper { 79 | 80 | text-align:center; 81 | } 82 | 83 | #main-wrapper ul li { 84 | /*display: table-cell;*/ 85 | border-radius: 6px; 86 | -moz-border-radius: 6px; 87 | -webkit-border-radius: 6px; 88 | background-color: #f8f8f8; 89 | padding: 2%; 90 | -webkit-box-shadow: 0px 3px 5px 0px rgba(50,50,50,0.22); 91 | -moz-box-shadow: 0px 3px 5px 0px rgba(50,50,50,0.22); 92 | box-shadow: 0px 3px 5px 0px rgba(50,50,50,0.22); 93 | text-align:center; 94 | float: left; 95 | width: 19%; 96 | margin: 1%; 97 | } 98 | #main-wrapper li a{ 99 | font-size: 18px; 100 | } 101 | 102 | #main-footer { 103 | border-top: 1px solid #e8e8e8; 104 | padding-bottom: 30px; 105 | padding-top: 40px; 106 | background: #f5f7f9; 107 | } 108 | 109 | #main-copyright { 110 | padding-bottom: 10px; 111 | padding-top: 20px; 112 | text-align: center; 113 | font-weight: normal; 114 | } 115 | 116 | #main-copyright > #container { 117 | font-size: 0.7em; 118 | text-align: center; 119 | } 120 | 121 | h4{ 122 | color: #7b7b7b; 123 | font-size: 20px; 124 | font-family: inherit; 125 | font-weight: 400; 126 | margin-bottom: 5px; 127 | } 128 | 129 | .col25p { 130 | float: left; 131 | width: 25%; 132 | } 133 | .green * { 134 | color: #1fa67a !important; 135 | } 136 | .blue * { 137 | color: #008dcb; 138 | } 139 | .red *{ 140 | color: #f30; 141 | } 142 | .black *{ 143 | color: #000; 144 | } 145 | .marine * { 146 | color: #205081; 147 | } 148 | .yellow * { 149 | color: #FFD801; 150 | } 151 | .grass * { 152 | color: #8AFB17; 153 | } 154 | 155 | .content-description{ 156 | position: relative; 157 | padding-top: 20px; 158 | } 159 | .black{ 160 | color: black; 161 | } 162 | 163 | .msp-connect{ 164 | background-image:url("../images/icon-connect.png"); 165 | width: 200px; 166 | height: 200px; 167 | margin-left: -10px; 168 | } 169 | .msp-fastcheckout{ 170 | background-image:url("../images/icon-fastcheckout.png"); 171 | width: 200px; 172 | height: 200px; 173 | margin-left: -10px; 174 | } 175 | .msp-gateways{ 176 | background-image:url("../images/icon-gateway-request.png"); 177 | width: 200px; 178 | height: 200px; 179 | margin-left: -10px; 180 | } 181 | .msp-ideal{ 182 | background-image:url("../images/icon-ideal.png"); 183 | width: 200px; 184 | height: 200px; 185 | margin-left: -10px; 186 | } 187 | .msp-payafter{ 188 | background-image:url("../images/icon-pay-after-delivery.png"); 189 | width: 200px; 190 | height: 200px; 191 | margin-left: -10px; 192 | } 193 | .msp-klarna{ 194 | background-image:url("../images/icon-klarna.png"); 195 | width: 200px; 196 | height: 200px; 197 | margin-left: -10px; 198 | } 199 | .msp-splitpayment{ 200 | background-image:url("../images/icon-split-payments.png"); 201 | width: 200px; 202 | height: 200px; 203 | margin-left: -10px; 204 | } 205 | .msp-recurring{ 206 | background-image:url("../images/icon-recurring-payments.png"); 207 | width: 200px; 208 | height: 200px; 209 | margin-left: -10px; 210 | } 211 | .msp-transaction{ 212 | background-image:url("../images/icon-transaction-refund.png"); 213 | width: 200px; 214 | height: 200px; 215 | margin-left: -10px; 216 | } 217 | .msp-update{ 218 | background-image:url("../images/icon-update-transaction.png"); 219 | width: 200px; 220 | height: 200px; 221 | margin-left: -10px; 222 | } 223 | 224 | .msp-details{ 225 | background-image:url("../images/icon-get-details.png"); 226 | width: 200px; 227 | height: 200px; 228 | margin-left: -10px; 229 | } 230 | 231 | 232 | .fa-tachometer{ 233 | margin-bottom: 20px; 234 | } 235 | .left-align{ 236 | text-align: left; 237 | } 238 | a{ 239 | color: red; 240 | } 241 | a:hover{ 242 | color: red; 243 | } 244 | 245 | .idealselection{ 246 | margin-top: 20px; 247 | width: 200px; 248 | height: 34px; 249 | overflow: hidden; 250 | border: 1px solid #ccc; 251 | } 252 | 253 | .submitbutton{ 254 | background: #25A6E1; 255 | background: -moz-linear-gradient(top,#25A6E1 0%,#188BC0 100%); 256 | background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#25A6E1),color-stop(100%,#188BC0)); 257 | background: -webkit-linear-gradient(top,#25A6E1 0%,#188BC0 100%); 258 | background: -o-linear-gradient(top,#25A6E1 0%,#188BC0 100%); 259 | background: -ms-linear-gradient(top,#25A6E1 0%,#188BC0 100%); 260 | background: linear-gradient(top,#25A6E1 0%,#188BC0 100%); 261 | filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#25A6E1',endColorstr='#188BC0',GradientType=0); 262 | padding:8px 13px; 263 | color:#fff; 264 | font-family:'Helvetica Neue',sans-serif; 265 | font-size:17px; 266 | border-radius:4px; 267 | -moz-border-radius:4px; 268 | -webkit-border-radius:4px; 269 | border:1px solid #1A87B9 270 | } 271 | 272 | pre{ 273 | font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif; 274 | margin-bottom: 10px; 275 | overflow: auto; 276 | width: auto; 277 | padding: 5px; 278 | background-color: #eee; 279 | width: 650px!ie7; 280 | padding-bottom: 20px!ie7; 281 | max-height: 600px; 282 | font-size: 11px; 283 | } 284 | 285 | ol{ 286 | margin-top: 10px; 287 | margin-left: 20px; 288 | color: black; 289 | } 290 | ol li span{ 291 | position: relative; 292 | margin-left: 100px; 293 | } 294 | 295 | h1, h2, h3{ 296 | color: black; 297 | } -------------------------------------------------------------------------------- /assets/images/multisafepay-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 14 | 20 | 23 | 30 | 35 | 42 | 48 | 55 | 61 | 68 | 74 | 79 | 80 | -------------------------------------------------------------------------------- /assets/images/multisafepaylogo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 11 | 15 | 18 | 22 | 26 | 27 | 28 | 33 | 37 | 42 | 46 | 51 | 55 | 58 | 59 | 60 | 62 | 63 | 64 | 66 | 67 | 69 | 70 | 72 | 73 | 74 | 82 | 86 | 91 | 93 | 96 | 99 | 104 | 107 | 111 | 116 | 118 | 121 | 129 | 134 | 136 | 137 | 140 | 144 | 149 | 157 | 158 | 159 | --------------------------------------------------------------------------------