650 likes | 778 Vues
Google Checkout API. Jingsong Wang Arpril 2, 2007. Agenda. Why How to use How to integrate. Agenda. Why How to use How to integrate. Why Google Checkout. Sell more. Spend less. Grow your business. Why Google Checkout (cont..). Customers, You
E N D
Google Checkout API Jingsong Wang Arpril 2, 2007
Agenda • Why • How to use • How to integrate
Agenda • Why • How to use • How to integrate
Why Google Checkout • Sell more. • Spend less. • Grow your business.
Why Google Checkout (cont..) • Customers, You • Google Checkout is a fast, convenient checkout process that complements your existing process • until 2008, FREE..
Benefits • Attract more leads. • Convert more leads into sales. • Process sales for free. • Protect yourself from fraud.
Example <form method="POST" action="https://sandbox.google.com/checkout/cws/v2/Merchant/1234567890/checkoutForm" accept-charset="utf-8"> <input type="hidden" name="item_name_1" value="Peanut Butter"/> <input type="hidden" name="item_description_1" value="Chunky peanut butter."/> <input type="hidden" name="item_quantity_1" value="1"/> <input type="hidden" name="item_price_1" value="3.99"/> <input type="hidden" name="ship_method_name_1" value="UPS Ground"/> <input type="hidden" name="ship_method_price_1" value="10.99"/> <input type="hidden" name="tax_rate" value="0.0875"/> <input type="hidden" name="tax_us_state" value="NY"/> <input type="hidden" name="_charset_"/> <input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=1234567890&w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180"/> </form>
Agenda • Why • How to use • How to integrate
Agenda • Why • How to use • How to integrate
How to integrate • HTML APIs • XML APIs
How to integrate 1. Go to http://sandbox.google.com/checkout/sell/ to set up test accounts in the Google Checkout Sandbox service. • Create your buyer account at http://sandbox.google.com/checkout. • Create your merchant account at http://sandbox.google.com/checkout/sell/.
How to integrate (cont) 2. Go to http://checkout.google.com/sell/signup to sign up for a Google Checkout merchant account
How to integrate (cont) 3. Sign in to your test merchant account at https://sandbox.google.com/checkout/sell to locate your Merchant ID and your Merchant Key.
How to integrate (cont) 4. Add a Google Checkout button to the checkout pages on your online store.
How to integrate (cont) 5. Modify the code for your online store so that the form containing the Google Checkout button also submits information about your customer's order.
Sending Checkout API Requests to Google • In your development environment: https://sandbox.google.com/checkout/cws/v2/Merchant/[[Merchant ID]]/checkoutForm • In your production system: • https://checkout.google.com/cws/v2/Merchant/[[Merchant ID]]/checkoutForm
Checkout API • Query key strings • Item Parameters • item_name_# * - The parameter value identifies the name of the item. • item_description_# * - The parameter value provides a description of the item. • item_quantity_# - The parameter value identifies how many units of a particular item are included in the customer's shopping cart. • item_price_#* - The parameter value identifies the price of the item. • item_currency_# - The parameter value identifies the currency for the item price. The default value is USD (U.S. dollars). • Shipping Parameters… • Tax Parameters…
<form method="POST" action="https://sandbox.google.com/checkout/cws/v2/Merchant/1234567890/checkoutForm" accept-charset="utf-8"> <input type="hidden" name="item_name_1" value="Peanut Butter"/> <input type="hidden" name="item_description_1" value="Chunky peanut butter."/> <input type="hidden" name="item_quantity_1" value="1"/> <input type="hidden" name="item_price_1" value="3.99"/> <input type="hidden" name="item_name_2" value="Grape Jelly"/> <input type="hidden" name="item_description_2" value="16 oz. bottle of Concord grape jelly."/> <input type="hidden" name="item_quantity_2" value="1"/> <input type="hidden" name="item_price_2" value="4.49"/> <input type="hidden" name="ship_method_name_1" value="UPS Air"/> <input type="hidden" name="ship_method_price_1" value="19.99"/> <input type="hidden" name="ship_method_us_area_1" value="CONTINENTAL_48"/> <input type="hidden" name="ship_method_name_2" value="UPS Ground"/> <input type="hidden" name="ship_method_price_2" value="10.99"/> <input type="hidden" name="ship_method_us_area_2" value="FULL_50_STATES"/> <input type="hidden" name="tax_rate" value="0.0875"/> <input type="hidden" name="tax_us_state" value="NY"/> <input type="hidden" name="_charset_"/> <input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=1234567890 &w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180"/> </form>
Viewing Order Statuses in the Merchant Center • financial-order-state • fulfillment-order-state
Integration • Modify the code for your online store: • Your code needs to create an XML document containing information about the items in your customer's shopping cart • The XML will also contain information about the shipping options that the customer can select and the taxes that should be added to the order • Your code will need to encrypt the XML document and embed the encrypted value in the form that contains the Google Checkout button
Integration (cont) • In your development environment: • <form method="POST" action="https://sandbox.google.com/checkout/cws/v2/Merchant/[[Merchant-ID]]/checkout"> • In your production system: • <form method="POST" action="https://checkout.google.com/cws/v2/Merchant/[[Merchant-ID]]/checkout">
When the customer clicks the Google Checkout button • Two methods to send information about the customer's order to Google so that the customer can complete the purchase. • You can configure your form to submit directly to Google Checkout. If you choose this option, you must add code to your site that constructs an XML document containing information about the customer's order as well as information about your shipping options and tax policies. You will then encode the XML document and embed it in the form that displays the Google Checkout button. • You can configure your form to submit to a page on your site that will then create an XML document containing information about the order. Your application will then post the XML to Google using an HTTP POST request. Google will then respond to your request with a Google Checkout URL where your customer can complete the order, and you will redirect the customer to that URL.
Integration Options • Level 1 Integration - Shopping Cart Integration • Level 2 Integration - Order Processing Integration
Level 1 Integration –Shopping Cart Integration • By implementing the Checkout API, you will have completed a Level 1 Checkout integration. • At this integration level, you will receive new order notifications via email. You can then manage orders using the Merchant Center, a Google application that lets you track orders from your web browser.
Level 2 Integration – Order Processing Integration • The Notification API enables Google to inform merchants of new orders submitted through Google Checkout or to send updates for existing orders. As such, the Notification API allows merchants to modify their systems to automatically receive order information from Google Checkout. • The Order Processing API provides functions that let merchants change an order's status or add information to an order. Thus, the Order Processing API lets merchants modify their systems to automatically update Google Checkout orders. • To implement these APIs, you must create a web service that sends and receives XML messages about new orders and order status updates
Processing an Order • (This process flow describes the first method, in which the order information is embedded in the form that displays the Google Checkout button. When the customer clicks the Google Checkout button, the customer's browser will submit the order directly to Google. )
Processing an Order (cont..) • The first stage in the process explains how to send shopping cart information to Google Checkout. These steps are the same for Level 1 and Level 2 integrations. • The second stage of the process describes the order fulfillment process. • If you have completed a Level 1 integration, you will complete the second set of steps through the Merchant Center. If you have completed a Level 2 integration, you can modify your internal order processing systems to handle these steps. You can also opt to use the Merchant Center for these steps.
Processing an Order (cont..) 1. Your customer selects items on your website. • Create a checkout shopping cart for the buyer's items as an XML structure. • Create a signature for the shopping cart using the HMAC_SHA1 function. • Base64-encode the cart. • Base64-encode the signature. • Put the cart and signature into a Google Checkout button form. Note: If you choose the second method of implementing the Checkout API, these steps will be replaced by the steps in the Submitting Server-to-Server Checkout API Requests 2. After your customer completes the order through Google Checkout, you process the order and ship items to the customer. • Receive the new order notification. • Charge the order. • Add tracking information to the order. • Mark the order shipped . • Archive the order.
Checkout API • Checkout API requests send order information from a merchant's website to Google, enabling a customer to complete an order using Google Checkout. The <checkout-shopping-cart> element is the root tag for Checkout API requests. This tag contains three subtags. • <shopping-cart> • <checkout-flow-support> • optional <order-processing-support> element contains information about how Google should process an order or how Google should convey data about the order to the merchant. Currently, you would only use this element if you wanted to instruct Google Checkout to send an <authorization-amount-notification> after a customer submits a new order and Google authorizes the customer's credit card. • The Processing an Order and Submitting Server-to-Server Checkout API Requests sections of this document explain two different processes for creating and submitting Checkout API requests.
Create an HMAC-SHA-1 signature • You must create an HMAC-SHA-1 signature, a cryptographically secure value that enables Google to verify that the XML in the <checkout-shopping-cart> structure was not altered before Google received it. • Most development environments provide a function for creating HMAC-SHA-1 signatures. To create the signature, call the appropriate function, passing the <checkout-shopping-cart> XML structure and your Merchant Key as parameters to the function.
Base64-encode the cart • After you create the signature, base64-encode the <checkout-shopping-cart> XML structure
Base64-encode the HMAC-SHA-1 signature • Using the same function that you called to encode the shopping cart, base64-encode the HMAC-SHA-1 signature that you created in step ii.
Add the order information and signature to a Google Checkout button form • Add those values to the form on your page that displays a Google Checkout button.
Receive the new order notification • When a customer submits an order, Google can notify you that the new order has been submitted. There are two ways to receive new order notifications: • Google can send email notifications for new orders. If you have not implemented the Notification API, Google will automatically email you to notify you have new orders. • Level 2 only: If you have implemented the Notification API, Google will send a new-order-notification to inform you of the new order. The notification will include the order shopping cart as well as other transaction details such as the shipping method, shipping address and taxes for the order.
Add tracking information to the order • After shipping the order, you can add shipment tracking information that will appear on the buyer's account page. There are two ways: • Log in to your Merchant Center account. • Level 2 only: If you have implemented the Order Processing API, you can add tracking information by sending an add-tracking-data command to Google.
Mark the order shipped • Once the order has been shipped, you can also mark it Shipped in the Merchant Center and on the buyer's account page. There are two ways: • Log in to your Merchant Center account. • Level 2 only: If you have implemented the Order Processing API, you can send a deliver-order command to Google.