SilverShop and Omnipay Slides

Hi
@bummzack
SilverShop
What happened
• Rebranded as “SilverShop”
• 2.0 was released in July 2016
• Current version is 2.1
• Mark Guinn retired as a Maintainer
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
Features added via modules
• Stock-Management
• Discounts and Coupons
• Various Shipping-Methods
• Product-Search
• Colored-Variations
• AJAX functionality
Why use SilverShop?
SilverShop and Omnipay Slides
Seriously though…
An example
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
SilverStripe & Omnipay
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
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 OmnipayOmnipay;
…
A simple example 1/3
composer require omnipay/paypal
# purchase.php
require_once 'vendor/autoload.php';

use OmnipayOmnipay;



$gateway = Omnipay::create('PayPal_Express');
…
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

]);
…
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'

]);
…
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();

}
SilverShop and Omnipay Slides
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();

}
The silverstripe-omnipay module
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.
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
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/payment.yml
---

Name: payment-config

---

GatewayInfo:

PayPal_Express:

parameters:

username: 'username.example.com'

password: '0123456789'

signature: 'AbUnchOFRandOMChaActeRS.muCHSiGnaTURe11101'

testMode: true
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 purchase(){

$payment = Payment::create()

->init('PayPal_Express', 10, 'USD')

->setSuccessUrl($this->Link('completed'))

->setFailureUrl($this->Link('cancelled'));

…
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);

…
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();

}
A simple example 3/3
https://shop.example.com/paymentendpoint/<hash>/complete
https://shop.example.com/mypaymentpage/completed
silverstripe-omnipay-ui module
SilverShop and Omnipay Slides
Thanks!
Questions?
1 of 44

Recommended

Payments On Rails by
Payments On RailsPayments On Rails
Payments On RailsE-xact Transactions
1.8K views46 slides
Activemerchant by
ActivemerchantActivemerchant
ActivemerchantKrzysztof Jabłoński
233 views9 slides
Paypal REST api ( Japanese version ) by
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Yoshi Sakai
3.8K views29 slides
Saferpay Checkout Page - PHP Sample (Hosting) by
Saferpay Checkout Page - PHP Sample (Hosting)Saferpay Checkout Page - PHP Sample (Hosting)
Saferpay Checkout Page - PHP Sample (Hosting)webhostingguy
25.5K views2 slides
Joomla virtuemart razorpay payment gateway by
Joomla virtuemart razorpay payment gatewayJoomla virtuemart razorpay payment gateway
Joomla virtuemart razorpay payment gatewayWebkul Software Pvt. Ltd.
133 views14 slides
Mojolicious on Steroids by
Mojolicious on SteroidsMojolicious on Steroids
Mojolicious on SteroidsTudor Constantin
3.8K views15 slides

More Related Content

Similar to SilverShop and Omnipay Slides

Architecting fail safe data services by
Architecting fail safe data servicesArchitecting fail safe data services
Architecting fail safe data servicesMarc Mercuri
377 views65 slides
Prateek dayal backbonerails-110528024926-phpapp02 by
Prateek dayal backbonerails-110528024926-phpapp02Prateek dayal backbonerails-110528024926-phpapp02
Prateek dayal backbonerails-110528024926-phpapp02Revath S Kumar
691 views89 slides
Single Page Web Apps with Backbone.js and Rails by
Single Page Web Apps with Backbone.js and RailsSingle Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and RailsPrateek Dayal
3.8K views89 slides
Show me the money by
Show me the moneyShow me the money
Show me the moneyMohammad Emran Hasan
1.3K views17 slides
java and javascript api dev guide by
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guideZenita Smythe
218 views15 slides
Ntu workshop : REST, PayPal APIs & Async by
Ntu workshop : REST, PayPal APIs & AsyncNtu workshop : REST, PayPal APIs & Async
Ntu workshop : REST, PayPal APIs & AsyncAeshan Wijetunge
268 views35 slides

Similar to SilverShop and Omnipay Slides(20)

Architecting fail safe data services by Marc Mercuri
Architecting fail safe data servicesArchitecting fail safe data services
Architecting fail safe data services
Marc Mercuri377 views
Prateek dayal backbonerails-110528024926-phpapp02 by Revath S Kumar
Prateek dayal backbonerails-110528024926-phpapp02Prateek dayal backbonerails-110528024926-phpapp02
Prateek dayal backbonerails-110528024926-phpapp02
Revath S Kumar691 views
Single Page Web Apps with Backbone.js and Rails by Prateek Dayal
Single Page Web Apps with Backbone.js and RailsSingle Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and Rails
Prateek Dayal3.8K views
java and javascript api dev guide by Zenita Smythe
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guide
Zenita Smythe218 views
Ntu workshop : REST, PayPal APIs & Async by Aeshan Wijetunge
Ntu workshop : REST, PayPal APIs & AsyncNtu workshop : REST, PayPal APIs & Async
Ntu workshop : REST, PayPal APIs & Async
Aeshan Wijetunge268 views
Developing eCommerce Apps with the Shopify API by Josh Brown
Developing eCommerce Apps with the Shopify APIDeveloping eCommerce Apps with the Shopify API
Developing eCommerce Apps with the Shopify API
Josh Brown357 views
Apostrophe (improved Paris edition) by tompunk
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
tompunk3.3K views
Integration of payment gateways using Paypal account by Phenom People
Integration of payment gateways using Paypal account Integration of payment gateways using Paypal account
Integration of payment gateways using Paypal account
Phenom People10.2K views
An introduction to Laravel Passport by Michael Peacock
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock3K views
How to build a High Performance PSGI/Plack Server by Masahiro Nagano
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server
Masahiro Nagano18.6K views
Anatomy of payment systems in Drupal 8 by Oleg Natalushko
Anatomy of payment systems in Drupal 8Anatomy of payment systems in Drupal 8
Anatomy of payment systems in Drupal 8
Oleg Natalushko1.4K views
Say YES to Premature Optimizations by Maude Lemaire
Say YES to Premature OptimizationsSay YES to Premature Optimizations
Say YES to Premature Optimizations
Maude Lemaire142 views
Securing RESTful Payment APIs Using OAuth 2 by Jonathan LeBlanc
Securing RESTful Payment APIs Using OAuth 2Securing RESTful Payment APIs Using OAuth 2
Securing RESTful Payment APIs Using OAuth 2
Jonathan LeBlanc6.1K views
App Store Subscriptions - Condensed Edition by Mark Pavlidis
App Store Subscriptions - Condensed EditionApp Store Subscriptions - Condensed Edition
App Store Subscriptions - Condensed Edition
Mark Pavlidis461 views
Monetize your idea! - Pay Pal by Droidcon Spain
Monetize your idea! - Pay PalMonetize your idea! - Pay Pal
Monetize your idea! - Pay Pal
Droidcon Spain1.1K views

Recently uploaded

360 graden fabriek by
360 graden fabriek360 graden fabriek
360 graden fabriekinfo33492
138 views25 slides
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... by
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...Marc Müller
41 views62 slides
Generic or specific? Making sensible software design decisions by
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
6 views60 slides
nintendo_64.pptx by
nintendo_64.pptxnintendo_64.pptx
nintendo_64.pptxpaiga02016
5 views7 slides
Introduction to Maven by
Introduction to MavenIntroduction to Maven
Introduction to MavenJohn Valentino
6 views10 slides
Myths and Facts About Hospice Care: Busting Common Misconceptions by
Myths and Facts About Hospice Care: Busting Common MisconceptionsMyths and Facts About Hospice Care: Busting Common Misconceptions
Myths and Facts About Hospice Care: Busting Common MisconceptionsCare Coordinations
6 views1 slide

Recently uploaded(20)

360 graden fabriek by info33492
360 graden fabriek360 graden fabriek
360 graden fabriek
info33492138 views
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... by Marc Müller
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
Marc Müller41 views
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Myths and Facts About Hospice Care: Busting Common Misconceptions by Care Coordinations
Myths and Facts About Hospice Care: Busting Common MisconceptionsMyths and Facts About Hospice Care: Busting Common Misconceptions
Myths and Facts About Hospice Care: Busting Common Misconceptions
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium... by Lisi Hocke
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Lisi Hocke35 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi215 views
How Workforce Management Software Empowers SMEs | TraQSuite by TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuiteHow Workforce Management Software Empowers SMEs | TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuite
TraQSuite5 views
Airline Booking Software by SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta6 views
predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app7 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert21 views
FOSSLight Community Day 2023-11-30 by Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan5 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views
Sprint 226 by ManageIQ
Sprint 226Sprint 226
Sprint 226
ManageIQ8 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... by sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik8 views

SilverShop and Omnipay Slides

  • 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. 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. Features added via modules • Stock-Management • Discounts and Coupons • Various Shipping-Methods • Product-Search • Colored-Variations • AJAX functionality
  • 21. 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
  • 22. The Omnipay Architecture • Payment API via Gateways • Request/Response ≠ HTTP-Request/Response • Omnipay is stateless
  • 23. A simple example 1/3 composer require omnipay/paypal
  • 24. A simple example 1/3 composer require omnipay/paypal # purchase.php require_once 'vendor/autoload.php';
 use OmnipayOmnipay; …
  • 25. A simple example 1/3 composer require omnipay/paypal # purchase.php require_once 'vendor/autoload.php';
 use OmnipayOmnipay;
 
 $gateway = Omnipay::create('PayPal_Express'); …
  • 26. 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
 ]); …
  • 27. 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'
 ]); …
  • 28. 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();
 }
  • 30. 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();
 }
  • 32. 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.
  • 33. 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
  • 34. A simple example 1/3 composer require silverstripe/silverstripe-omnipay composer require omnipay/paypal
  • 35. 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
  • 36. A simple example 2/3 private static $allowed_actions = [
 'purchase', 'completed', 'cancelled'];
  • 37. 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'));
 …
  • 38. 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);
 …
  • 39. 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();
 }
  • 40. A simple example 3/3 https://shop.example.com/paymentendpoint/<hash>/complete https://shop.example.com/mypaymentpage/completed