Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Hi
@bummzack
SilverShop
What happened
• Rebranded as “SilverShop”
• 2.0 was released in July 2016
• Current version is 2.1
• Mark Guinn retired as...
Core-features
• Shopping-Cart
• Categories, Products, Variations
• Checkout, either Single- or Multi-Step
• Guest-Checkout...
Features added via modules
• Stock-Management
• Discounts and Coupons
• Various Shipping-Methods
• Product-Search
• Colore...
Why use SilverShop?
Seriously though…
An example
SilverStripe & Omnipay
The Omnipay Library
• Framework agnostic payment library
• Provides a single API for many different payment service provid...
The Omnipay Architecture
• Payment API via Gateways
• Request/Response ≠ HTTP-Request/Response
• Omnipay is stateless
A simple example 1/3
composer require omnipay/paypal
A simple example 1/3
composer require omnipay/paypal
# purchase.php
require_once 'vendor/autoload.php';

use OmnipayOmnipa...
A simple example 1/3
composer require omnipay/paypal
# purchase.php
require_once 'vendor/autoload.php';

use OmnipayOmnipa...
A simple example 1/3
composer require omnipay/paypal
# purchase.php
require_once 'vendor/autoload.php';

use OmnipayOmnipa...
A simple example 2/3
# … continued
$purchaseRequest = $gateway->purchase([

'amount' => '10.00',

'currency' => 'USD',

'r...
A simple example 2/3
# … continued
$purchaseRequest = $gateway->purchase([

'amount' => '10.00',

'currency' => 'USD',

'r...
A simple example 3/3
# completePurchase.php
$completePurchaseRequest = $gateway->completePurchase([

'amount' => '10.00',
...
The silverstripe-omnipay module
Features
• Provides a SilverStripe specific wrapper for omnipay
• Adds a persistence-layer (Payment DataObject)
• Provides ...
The architecture
• You create instances of Payment and use PaymentServices
that operate on these Payments.
• Services are ...
A simple example 1/3
composer require silverstripe/silverstripe-omnipay
composer require omnipay/paypal
A simple example 1/3
composer require silverstripe/silverstripe-omnipay
composer require omnipay/paypal
# mysite/_config/p...
A simple example 2/3
private static $allowed_actions = [

'purchase', 'completed', 'cancelled'];
A simple example 2/3
private static $allowed_actions = [

'purchase', 'completed', 'cancelled'];



public function purcha...
A simple example 2/3
private static $allowed_actions = [

'purchase', 'completed', 'cancelled'];



public function purcha...
A simple example 2/3
private static $allowed_actions = [

'purchase', 'completed', 'cancelled'];



public function purcha...
A simple example 3/3
https://shop.example.com/paymentendpoint/<hash>/complete
https://shop.example.com/mypaymentpage/compl...
silverstripe-omnipay-ui module
Thanks!
Questions?
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
SilverShop and Omnipay Slides
Upcoming SlideShare
Loading in …5
×

SilverShop and Omnipay Slides

250 views

Published on

Slides from StripeCon EU 2016 Talk about SilverShop and Omnipay

Published in: Software
  • Be the first to comment

  • Be the first to like this

SilverShop and Omnipay Slides

  1. 1. Hi @bummzack
  2. 2. SilverShop
  3. 3. What happened • Rebranded as “SilverShop” • 2.0 was released in July 2016 • Current version is 2.1 • Mark Guinn retired as a Maintainer
  4. 4. Core-features • Shopping-Cart • Categories, Products, Variations • Checkout, either Single- or Multi-Step • Guest-Checkout • User-Accounts and Address-Book • Supports a wide range of payment service providers via Omnipay
  5. 5. Features added via modules • Stock-Management • Discounts and Coupons • Various Shipping-Methods • Product-Search • Colored-Variations • AJAX functionality
  6. 6. Why use SilverShop?
  7. 7. Seriously though…
  8. 8. An example
  9. 9. SilverStripe & Omnipay
  10. 10. The Omnipay Library • Framework agnostic payment library • Provides a single API for many different payment service providers • authorize, capture, purchase, refund, void • 100% unit-tested
  11. 11. The Omnipay Architecture • Payment API via Gateways • Request/Response ≠ HTTP-Request/Response • Omnipay is stateless
  12. 12. A simple example 1/3 composer require omnipay/paypal
  13. 13. A simple example 1/3 composer require omnipay/paypal # purchase.php require_once 'vendor/autoload.php';
 use OmnipayOmnipay; …
  14. 14. A simple example 1/3 composer require omnipay/paypal # purchase.php require_once 'vendor/autoload.php';
 use OmnipayOmnipay;
 
 $gateway = Omnipay::create('PayPal_Express'); …
  15. 15. A simple example 1/3 composer require omnipay/paypal # purchase.php require_once 'vendor/autoload.php';
 use OmnipayOmnipay;
 
 $gateway = Omnipay::create('PayPal_Express');
 $gateway->initialize([
 'username' => 'username.example.com',
 'password' => '0123456789',
 'signature' => 'AbUnchOFRandOMChaActeRS.muCHSiGnaTURe11101',
 'testmode' => true
 ]); …
  16. 16. A simple example 2/3 # … continued $purchaseRequest = $gateway->purchase([
 'amount' => '10.00',
 'currency' => 'USD',
 'returnUrl' => 'https://shop.example.com/completePurchase.php',
 'cancelUrl' => 'https://shop.example.com/cancelPurchase.php'
 ]); …
  17. 17. A simple example 2/3 # … continued $purchaseRequest = $gateway->purchase([
 'amount' => '10.00',
 'currency' => 'USD',
 'returnUrl' => 'https://shop.example.com/completePurchase.php',
 'cancelUrl' => 'https://shop.example.com/cancelPurchase.php'
 ]); $purchaseResponse = $purchaseRequest->send();
 
 if ($purchaseResponse->isRedirect()) {
 $purchaseResponse->redirect();
 } else {
 echo $purchaseResponse->getMessage();
 }
  18. 18. A simple example 3/3 # completePurchase.php $completePurchaseRequest = $gateway->completePurchase([
 'amount' => '10.00',
 'currency' => 'USD',
 'returnUrl' => 'https://shop.example.com/completePurchase.php',
 'cancelUrl' => 'https://shop.example.com/cancelPurchase.php'
 ]); $completePurchaseResponse = $completePurchaseRequest->send();
 
 if ($completePurchaseResponse->isSuccessful()) {
 echo 'Payment complete!';
 } else {
 echo $completePurchaseResponse->getMessage();
 }
  19. 19. The silverstripe-omnipay module
  20. 20. Features • Provides a SilverStripe specific wrapper for omnipay • Adds a persistence-layer (Payment DataObject) • Provides URL endpoints for off-site payments • Can be configured using the config API.
  21. 21. The architecture • You create instances of Payment and use PaymentServices that operate on these Payments. • Services are commonly created through a ServiceFactory • Payment Services map to the Omnipay API: 
 authorize, capture, purchase, refund, void
  22. 22. A simple example 1/3 composer require silverstripe/silverstripe-omnipay composer require omnipay/paypal
  23. 23. A simple example 1/3 composer require silverstripe/silverstripe-omnipay composer require omnipay/paypal # mysite/_config/payment.yml ---
 Name: payment-config
 ---
 GatewayInfo:
 PayPal_Express:
 parameters:
 username: 'username.example.com'
 password: '0123456789'
 signature: 'AbUnchOFRandOMChaActeRS.muCHSiGnaTURe11101'
 testMode: true
  24. 24. A simple example 2/3 private static $allowed_actions = [
 'purchase', 'completed', 'cancelled'];
  25. 25. A simple example 2/3 private static $allowed_actions = [
 'purchase', 'completed', 'cancelled'];
 
 public function purchase(){
 $payment = Payment::create()
 ->init('PayPal_Express', 10, 'USD')
 ->setSuccessUrl($this->Link('completed'))
 ->setFailureUrl($this->Link('cancelled'));
 …
  26. 26. A simple example 2/3 private static $allowed_actions = [
 'purchase', 'completed', 'cancelled'];
 
 public function purchase(){
 $payment = Payment::create()
 ->init('PayPal_Express', 10, 'USD')
 ->setSuccessUrl($this->Link('completed'))
 ->setFailureUrl($this->Link('cancelled'));
 
 $service = ServiceFactory::create()->getService(
 $payment, ServiceFactory::INTENT_PURCHASE);
 …
  27. 27. A simple example 2/3 private static $allowed_actions = [
 'purchase', 'completed', 'cancelled'];
 
 public function purchase(){
 $payment = Payment::create()
 ->init('PayPal_Express', 10, 'USD')
 ->setSuccessUrl($this->Link('completed'))
 ->setFailureUrl($this->Link('cancelled'));
 
 $service = ServiceFactory::create()->getService(
 $payment, ServiceFactory::INTENT_PURCHASE); 
 $serviceResponse = $service->initiate();
 return $serviceResponse->redirectOrRespond();
 }
  28. 28. A simple example 3/3 https://shop.example.com/paymentendpoint/<hash>/complete https://shop.example.com/mypaymentpage/completed
  29. 29. silverstripe-omnipay-ui module
  30. 30. Thanks!
  31. 31. Questions?

×