Introduction
Using these API functions, you can interact with the MplusKASSA order workflow.
Whenever you create an order externally, you have to supply an external order identifier (extOrderId). You can use this identifier to find the order again.
External order identifiers are unique and therefore cannot be reused.
Notice: Orders are different from table orders, an order can not be changes to a tabel order. Make sure you implement the correct one for your use case.
Contents
- getOrders Retrieve orders
- createOrder Creating a new order
- findOrder Getting an existing order by extOrderId
- getOrder Getting an existing order by orderId
- updateOrder Updating an existing order
- cancelOrder Cancelling an order
- payOrder Paying an order
- deliverOrder Delivering an order
- getDeliveryMethods Get a list of available delivery methods
- getOrderCategories Get a list of available order categories
getOrders Retrieving orders
When you want to synchronize orders from Mplus to another application, it is smart to make use of Sync Markers.
createOrder Creating a new order
When creating an order, you are always required to attach a relation.
See the relations tutorial to learn how to manage relations through the API.
getOrder Method two: Getting order by its internal order identifier
updateOrder Updating an existing order
Updating an existing order is very similar to creating a new order, except this time you also add the internal order identifier.
That means you must first get the internal order identifier, for example by storing it when you first created the order, or by looking for it using the findOrder() function.
getOrder('001a3cd43892405b9689134b36656063'))) { // You can also use findOrder and extOrderId exit('Order does not exist.'); } // Then we modify the order array with the updated data. In this case, we change the lineList to: $order['lineList'] => array( array( 'articleNumber' => 14, // articleNumber must be present in Mplus 'data' => array( 'quantity' => 1, 'price' => 1995, // prices are always in cents 'discountPercentage' => 15, // optional discountPercentage 'discountAmount' => 0, // optional discountAmount 'vatCode' => 2, // VAT code ), 'text' => 'Stropdas', ), array( 'articleNumber' => 16, // articleNumber must be present in Mplus 'data' => array( 'quantity' => 2, 'price' => 799, // prices are always in cents 'discountPercentage' => 0, // optional discountPercentage 'discountAmount' => 0, // optional discountAmount 'vatCode' => 2, // VAT code ), 'text' => 'Sokken', ), ); // Then we call the updateOrder() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== $mplusqapiclient->updateOrder($order)) { // Success exit('Order successfully updated.'); } else { exit('Unable to update order.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); }
cancelOrder Cancelling an order
payOrder Paying an order
You can use the prepay parameter to signal if the order has been shipped already (false) or has not (true). If prepay is set to true, you will only make a deposit payment to the order, if prepay is set to false, you will also create a packing slip (signifying delivery) and invoice.
'K_WEBSHOP', // Must be defined in the Mplus database 'amount' => 1995, // Equivalent to 19,95 ), ); // Then we call the payOrder() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== $mplusqapiclient->payOrder($orderId, $prepay, $payments)) { exit('Order successfully paid.'); } else { exit('Unable to pay order.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); }
Voor het gebruik van deze call dienen er financiƫle afspraken gemaakt te worden met MplusKASSA.
deliverOrder Delivering an order
Successfully delivering an order creates a packing slip for that order, which can later be invoiced. You can use this to signal that an order has been shipped, but not yet paid.