A slick wrapper for the Moltin API
Moltin is a cutting-edge eCommerce solution. While relatively young, it's built upon a single, brilliant concept: a comprehensive eCommerce API. All of the front-end components are left for you to design at will.
This plugin gives you full access to the Moltin API, all through the familiar interface that Craft plugins already provide. Which means it's a breeze to interact with the Moltin API by writing your own simple plugin!
Get a product
There are a few ways to get product information. Here's one method...
$matches = craft()->moltin_products->find(['slug' => 'awesome-product']);
$product = $matches[0];
Add product to cart
If you don't specify a quantity, it will default to 1
...
craft()->moltin_cart->insert($product['id'], 1);
Convert cart to order
You'll need to convert your cart to an order to complete the checkout process...
$order = craft()->moltin_cart->order(['gateway' => 'stripe']);
Process payment
Provide the information required by your payment gateway...
$checkout = craft()->moltin_checkout->payment('purchase', $order['id'], [
'data' => [
'number' => '4242424242424242',
'expiry_month' => '02',
'expiry_year' => '2017',
'cvv' => '123'
]
]);
Congratulations! You've just completed a purchase!
Your authentication info is stored in the plugin's settings, so you'll never need to authenticate. Every call will be authenticated for you.
Simply add your authentication info when you first install the plugin!
- Full PHP-based API endpoints
- Twig accessibility for some API responses
- Craft 2.0
- PHP 5.4
- Compatible with Craft 2.5
- Updated PHP SDK (v1.0.2)
- Updated PHP SDK
- Switched to
dist
SDK
- Added JS API support
- Added remaining services
- Updated PHP SDK
- Initial beta release
Feel free to reach out with any questions, bugs, or feature requests! You can either open an issue here on Github, or email support@doublesecretagency.com
Keep in mind, this API wrapper is designed as a starting point... You're expected to build upon this API to create your own unique implementation of your eCommerce services in a separate plugin.
Happy coding!