SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Google
Checkout with
Ruby on Rails
Software Engineer, Consultant, Trainer
http://simplabs.com
Open Source
http://github.com/marcoow
http://github.com/simplabs
Marco Otte-Witte
USA/UK only!
Merchant Accounts
• Production Merchant Account
https://checkout.google.com/sell
• Sandbox Merchant Accournt
http://sandbox.google.com/checkout/sell
• => Merchant ID, Merchant Key
APIs
• HTML and XML APIs
• Notification APIs
• Example uses HTML API via HTTParty
Very(!) simple example
• Create Purchase with Google Checkout
• When Google Checkout confirms the
payment handle the Purchase in the app
Create Purchase
• Post an HTML Form to Google
• or create via HTML API:
post("/requestForm/Merchant/#{merchant_id}", :body => {
:_type => 'checkout-shopping-cart',
:'shopping-cart.items.item-1.item-name' => product.name,
:'shopping-cart.items.item-1.item-description' => product.description,
:'shopping-cart.items.item-1.quantity' => 1,
:'shopping-cart.items.item-1.unit-price' => price,
:'shopping-cart.items.item-1.unit-price.currency' => currency
})
• => returns serial-number to later identify
the purchase
Create Purchase
Notifications
• Register for Notifications:
(need SSH tunnel for local development)
Complete Purchase
• State Change Notifications:
def callback
type = params[:'_type']
serial_number = params[:'serial-number']
if type == 'order-state-change-notification'
order_state = params[:'new-financial-order-state']
purchase = GoogleCheckoutPurchase.find_by_serial_number(serial_number)
case order_state.try(:downcase)
when 'charged'
purchase.book!
when 'payment_declined', 'cancelled', 'cancelled_by_google'
purchase.fail!
end
end
render :text => "serial-number=#{serial_number}", :status => :ok
rescue
head :internal_server_error
end
A lot more can
be done!
Resources
• http://code.google.com/intl/de-DE/apis/checkout/
• https://rubygems.org/gems/google4r-checkout
Q&A

Weitere ähnliche Inhalte

Andere mochten auch (6)

Ember.SimpleAuth
Ember.SimpleAuthEmber.SimpleAuth
Ember.SimpleAuth
 
Open eGo, open source eGov-platform - Congres 2009 - V-ICT-OR
Open eGo, open source eGov-platform - Congres 2009 - V-ICT-OROpen eGo, open source eGov-platform - Congres 2009 - V-ICT-OR
Open eGo, open source eGov-platform - Congres 2009 - V-ICT-OR
 
Excellent
ExcellentExcellent
Excellent
 
Day 1 Jordan's Energy Efficiency Policies
Day 1 Jordan's Energy Efficiency PoliciesDay 1 Jordan's Energy Efficiency Policies
Day 1 Jordan's Energy Efficiency Policies
 
RSpec
RSpecRSpec
RSpec
 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
 

Ähnlich wie Google Checkout with Ruby on Rails

Ähnlich wie Google Checkout with Ruby on Rails (20)

Google Checkout for Umbraco
Google Checkout for UmbracoGoogle Checkout for Umbraco
Google Checkout for Umbraco
 
Shopify
ShopifyShopify
Shopify
 
Chrome Web Store に登録してみた
Chrome Web Store に登録してみたChrome Web Store に登録してみた
Chrome Web Store に登録してみた
 
A Tale of Two Shopping Carts - Cart66 vs WooCommerce
A Tale of Two Shopping Carts - Cart66 vs WooCommerceA Tale of Two Shopping Carts - Cart66 vs WooCommerce
A Tale of Two Shopping Carts - Cart66 vs WooCommerce
 
Flamingo Commerce Module Details
Flamingo Commerce Module DetailsFlamingo Commerce Module Details
Flamingo Commerce Module Details
 
Building Ecommerce Storefronts on the JAMstack
Building Ecommerce Storefronts on the JAMstackBuilding Ecommerce Storefronts on the JAMstack
Building Ecommerce Storefronts on the JAMstack
 
Testing In App Billing
Testing In App BillingTesting In App Billing
Testing In App Billing
 
OpenCart Amazon Connector Extension
OpenCart Amazon Connector ExtensionOpenCart Amazon Connector Extension
OpenCart Amazon Connector Extension
 
An Introduction to Drupal Commerce & Real World Examples
An Introduction to Drupal Commerce & Real World ExamplesAn Introduction to Drupal Commerce & Real World Examples
An Introduction to Drupal Commerce & Real World Examples
 
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using ClearbitCustomer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
 
How to migrate Yahoo Store to Shopify with Litextension
How to migrate Yahoo Store to Shopify with LitextensionHow to migrate Yahoo Store to Shopify with Litextension
How to migrate Yahoo Store to Shopify with Litextension
 
B2C-Commerce-Developer Dumps
B2C-Commerce-Developer DumpsB2C-Commerce-Developer Dumps
B2C-Commerce-Developer Dumps
 
LA2M Google Tools Presentation Apr 1st 09
LA2M Google Tools Presentation Apr 1st 09LA2M Google Tools Presentation Apr 1st 09
LA2M Google Tools Presentation Apr 1st 09
 
Custom Automation Masterclass – Workshop 2: Email validation using kKckbox
Custom Automation Masterclass – Workshop 2: Email validation using kKckboxCustom Automation Masterclass – Workshop 2: Email validation using kKckbox
Custom Automation Masterclass – Workshop 2: Email validation using kKckbox
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integration
 
Ecommerce for Associations
Ecommerce for AssociationsEcommerce for Associations
Ecommerce for Associations
 
How To: Use Google Search Ap Is On Your Blog
How To: Use Google Search Ap Is On Your BlogHow To: Use Google Search Ap Is On Your Blog
How To: Use Google Search Ap Is On Your Blog
 
Cart creation-101217222728-phpapp01
Cart creation-101217222728-phpapp01Cart creation-101217222728-phpapp01
Cart creation-101217222728-phpapp01
 
How to Integrate Google Adwords API in Laravel App.pdf
How to Integrate Google Adwords API in Laravel App.pdfHow to Integrate Google Adwords API in Laravel App.pdf
How to Integrate Google Adwords API in Laravel App.pdf
 
How to Integrate Google Adwords API in Laravel App.pdf
How to Integrate Google Adwords API in Laravel App.pdfHow to Integrate Google Adwords API in Laravel App.pdf
How to Integrate Google Adwords API in Laravel App.pdf
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

Google Checkout with Ruby on Rails

  • 2. Software Engineer, Consultant, Trainer http://simplabs.com Open Source http://github.com/marcoow http://github.com/simplabs Marco Otte-Witte
  • 4. Merchant Accounts • Production Merchant Account https://checkout.google.com/sell • Sandbox Merchant Accournt http://sandbox.google.com/checkout/sell • => Merchant ID, Merchant Key
  • 5. APIs • HTML and XML APIs • Notification APIs • Example uses HTML API via HTTParty
  • 6. Very(!) simple example • Create Purchase with Google Checkout • When Google Checkout confirms the payment handle the Purchase in the app
  • 7. Create Purchase • Post an HTML Form to Google • or create via HTML API: post("/requestForm/Merchant/#{merchant_id}", :body => { :_type => 'checkout-shopping-cart', :'shopping-cart.items.item-1.item-name' => product.name, :'shopping-cart.items.item-1.item-description' => product.description, :'shopping-cart.items.item-1.quantity' => 1, :'shopping-cart.items.item-1.unit-price' => price, :'shopping-cart.items.item-1.unit-price.currency' => currency }) • => returns serial-number to later identify the purchase
  • 9. Notifications • Register for Notifications: (need SSH tunnel for local development)
  • 10. Complete Purchase • State Change Notifications: def callback type = params[:'_type'] serial_number = params[:'serial-number'] if type == 'order-state-change-notification' order_state = params[:'new-financial-order-state'] purchase = GoogleCheckoutPurchase.find_by_serial_number(serial_number) case order_state.try(:downcase) when 'charged' purchase.book! when 'payment_declined', 'cancelled', 'cancelled_by_google' purchase.fail! end end render :text => "serial-number=#{serial_number}", :status => :ok rescue head :internal_server_error end
  • 11. A lot more can be done!
  • 13. Q&A