Google Checkout API全文-大学课件-在线文档_第1页
Google Checkout API全文-大学课件-在线文档_第2页
Google Checkout API全文-大学课件-在线文档_第3页
Google Checkout API全文-大学课件-在线文档_第4页
Google Checkout API全文-大学课件-在线文档_第5页
已阅读5页,还剩60页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Google

CheckoutAPI1Jingsong

WangArpril

2,

2007Agenda2WhyHow

to

useHow

to

integrateAgenda3WhyHow

to

useHow

to

integrateWhy

Google

Checkout4Sellmore.Spend

less.Grow

your

business.Why

Google

Checkout

(cont..)5Customers,

You

Google

Checkout

is

a

fast,

convenient

checkout

process

thatcomplements

your

existing

process·

until

2008,

FREE..Benefits6Attractmore

leads.Convert

more

leads

into

sales.Process

sales

for

free.Protect

yourself

from

fraud.Example7<form

method="POST"

action="/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="/checkout/buttons/checkout.gif?merchant_id=1234567890&w=180&h=46&style=white&variant=text&loc=en_US"

height="46"

width="180"/></form>8Agenda9WhyHow

to

useHow

to

integrateSign

In/Sign

Up

page10Place

Order11Order

Confirmation12Agenda13WhyHow

to

useHow

to

integrateHow

to

integrate14HTML

APIsXML

APIsHow

to

integrate15Go

to

/checkout/sell/

to

set

up

test

accounts

in

the

Google

Checkout

Sandbox

service.Create

your

buyer

account

at

/checkout.Create

yourmerchant

accountat

/checkout/sell/.How

to

integrate

(cont)162.

Go

to

/sell/signup

to

sign

up

for

a

Google

Checkout

merchant

accountHow

to

integrate

(cont)173.

Sign

in

to

your

test

merchant

account

at/checkout/sell

to

locate

your

MerchantID

and

your

Merchant

Key.How

to

integrate

(cont)184.

Add

a

Google

Checkout

button

to

the

checkout

pages

on

youronline

store.How

to

integrate

(cont)195.

Modify

the

code

for

your

online

store

so

that

the

form

containingthe

Google

Checkout

button

also

submits

information

about

yourcustomer"s

order.HTML20Sending

Checkout

API

Requests

toGoogleIn

your

development

environment: /checkout/cws/v2/Merchant/[[MerchantID]]/checkoutFormIn

your

production

system:·

/cws/v2/Merchant/[[Merchant

ID]]/checkoutForm21Checkout

API22Query

keystringsItemParametersitem_name_#

*

-

The

parameter

value

identifies

the

name

of

the

item.

item_description_#

*

-

The

parameter

value

provides

a

description

of

theitem.

item_quantity_#

-

Theparameter

valueidentifies

how

many

units

of

aparticular

item

are

included

in

the

customer"s

shoppingcart.item_price_#*

-

The

parameter

value

identifies

the

price

of

the

item.

item_currency_#

-

The

parameter

value

identifies

the

currency

for

the

itemprice.

The

default

value

is

USD

(U.S.

dollars).Shipping

Parameters…Tax

Parameters…<form

method="POST"action="/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="/checkout/buttons/checkout.gif?merchant_id=1234567890&w=180&h=46&style=white&variant=text&loc=en_US"

height="46"

width="180"/></form>23Viewing

Order

Statuses

in

theMerchant

Centerfinancial-order-statefulfillment-order-state24252627XML28Integration29Modify

the

code

for

your

online

store:Yourcode

needs

to

create

an

XML

document

containing

information

about

theitems

inyour

customer"sshopping

cartThe

XML

will

also

contain

information

about

the

shipping

options

that

thecustomer

can

select

and

the

taxes

that

should

be

added

to

the

orderYour

code

will

need

to

encrypt

the

XML

document

and

embed

the

encryptedvalue

in

the

formthat

contains

the

GoogleCheckout

buttonIntegration

(cont)30Inyour

development

environment:<form

method="POST" action="/checkout/cws/v2/Merchant/[[Merchant-ID]]/checkout">In

your

production

system:<form

method="POST" action="/cws/v2/Merchant/[[Merchant-ID]]/checkout">Google

Checkout

Buttons3132When

the

customer

clicks

theGoogle

Checkout

button33

Two

methods

to

send

information

about

the

customer"s

order

toGoogle

so

that

the

customer

can

complete

the

purchase.You

can

configure

your

form

to

submit

directly

to

Google

Checkout.

If

youchoose

this

option,

you

must

add

code

to

your

site

that

constructs

an

XMLdocument

containing

information

about

the

customer"s

order

as

well

asinformation

about

your

shipping

options

and

tax

policies.

You

will

then

encodethe

XML

documentand

embed

it

in

the

form

that

displays

the

Google

Checkoutbutton.You

can

configure

your

form

to

submit

to

a

page

on

your

site

that

will

then

createan

XML

document

containing

information

about

the

order.

Your

application

willthen

post

the

XML

to

Google

using

an

HTTP

POST

request.

Google

will

thenrespond

to

your

request

with

a

Google

Checkout

URL

where

your

customer

cancomplete

the

order,

and

you

will

redirect

the

customer

to

that

URL.Integration

Options34Level

1

Integration

-

Shopping

Cart

IntegrationLevel

2

Integration

-

Order

Processing

IntegrationLevel

1

Integration

–Shopping

Cart

Integration35

By

implementingthe

Checkout

API,

you

will

have

completed

a

Level1

Checkout

integration.

At

this

integration

level,

you

will

receive

new

order

notifications

viaemail.

You

can

then

manage

orders

using

the

Merchant

Center,

aGoogle

application

that

lets

you

track

orders

from

your

web

browser.Level

2

Integration

–Order

Processing

Integration36The

Notification

API

enables

Google

to

inform

merchants

of

new

orderssubmitted

throughGoogleCheckoutor

to

send

updates

for

existing

orders.As

such,

the

Notification

API

allows

merchants

tomodifytheir

systems

toautomatically

receive

order

information

from

Google

Checkout.The

Order

Processing

API

provides

functions

that

let

merchants

changean

order"s

status

or

add

information

to

an

order.

Thus,

the

Order

ProcessingAPI

lets

merchantsmodifytheir

systems

to

automatically

update

GoogleCheckout

orders.

Toimplementthese

APIs,youmust

create

a

web

service

that

sends

andreceives

XML

messages

about

new

orders

and

order

status

updatesProcessing

an

Order37

(This

process

flow

describes

the

first

method,

in

which

the

orderinformation

is

embedded

in

the

form

that

displays

the

GoogleCheckout

button.

When

the

customer

clicks

the

Google

Checkoutbutton,

the

customer"sbrowser

will

submit

the

order

directly

toGoogle.

)Processing

an

Order

(cont..)38

The

first

stage

in

the

process

explains

how

to

send

shopping

cartinformation

to

Google

Checkout.

These

steps

are

the

same

forLevel1

and

Level

2

integrations.

The

second

stage

of

the

process

describes

the

order

fulfillmentprocess.

If

you

have

completed

a

Level

1

integration,

you

will

complete

thesecond

set

of

steps

through

the

Merchant

Center.

If

you

havecompleted

a

Level

2

integration,

you

can

modify

your

internal

orderprocessing

systems

to

handle

these

steps.

You

can

also

opt

to

usethe

Merchant

Center

for

these

steps.Processing

an

Order

(cont..)39Your

customer

selects

items

on

your

website.Create

a

checkout

shopping

cart

for

the

buyer"s

itemsas

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

bereplaced

by

the

steps

in

the

Submitting

Server-to-Server

Checkout

API

RequestsAfter

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.Create

a

checkout

shopping

cart40Checkout

API41

CheckoutAPI

requests

send

order

information

from

a

merchant"s

website

toGoogle,

enabling

a

customer

to

complete

an

order

using

Google

Checkout.The

<checkout-shopping-cart>

element

is

the

root

tag

forCheckout

APIrequests.

This

tag

contains

three

subtags.<shopping-cart><checkout-flow-support>optional

<order-processing-support>

element

contains

informationabout

how

Google

should

process

an

order

or

how

Google

shouldconvey

data

about

the

order

to

the

merchant.

Currently,

youwould

onlyuse

this

element

if

you

wanted

to

instruct

Google

Checkout

to

send

an<authorization-amount-notification>

after

a

customer

submits

a

neworder

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

forcreating

and

submitting

Checkout

API

requests.Create

an

HMAC-SHA-1

signature42

You

must

create

an

HMAC-SHA-1

signature,

a

cryptographicallysecure

value

that

enables

Google

to

verify

that

the

XML

in

the<checkout-shopping-cart>

structure

was

not

altered

before

Googlereceived

it.

Most

development

environments

provide

a

function

for

creatingHMAC-SHA-1

signatures.

To

create

the

signature,

call

theappropriate

function,

passing

the

<checkout-shopping-cart>

XMLstructure

and

your

Merchant

Key

as

parameters

to

the

function.Base64-encode

the

cart43

After

you

create

the

signature,

base64-encode

the

<checkout-

shopping-cart>

XML

structureBase64-encode

the

HMAC-SHA-1signature44Using

the

same

function

that

you

called

to

encode

the

shopping

cart, base64-encode

the

HMAC-SHA-1

signature

that

you

created

instep

ii.Add

the

order

information

and

signature

to

aGoogle

Checkout

button

form

Add

those

values

to

the

form

on

your

page

that

displays

a

GoogleCheckout

button.4546Receive

the

new

order

notification47

When

a

customer

submits

an

order,

Google

can

notify

you

that

thenew

order

has

been

submitted.

There

are

two

ways

to

receive

neworder

notifications:Google

can

send

email

notifications

for

new

orders.

If

you

have

notimplemented

the

Notification

API,

Google

will

automatically

email

you

tonotify

you

have

new

orders.Level

2

only:

If

you

have

implemented

the

Notification

API,

Google

willsend

a

new-order-notification

to

inform

you

of

the

new

order.

Thenotification

will

include

the

order

shopping

cart

as

well

as

othertransaction

details

such

as

the

shipping

method,

shipping

address

andtaxes

for

the

order.48Add

tracking

information

to

theorder

After

shipping

the

order,

you

can

add

shipment

tracking

informationthat

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

canaddtrackinginformation

by

sending

an

add-tracking-data

command

to

Google.49Mark

the

order

shipped

Once

the

order

has

been

shipped,

you

can

also

mark

it

Shipped

inthe

Merchant

Center

and

on

the

buyer"s

account

page.

There

aretwo

ways:Log

in

to

your

Merchant

Center

account.Level

2

only:

If

you

have

implemented

the

Order

Processing

API,

you

can

senda

deliver-order

command

to

Google.50Archive

the

order

After

the

order

has

been

delivered,

you

can

archive

the

order

toremove

it

from

the

list

of

active

orders

that

appears

on

the

Orderspage

of

the

Merchant

Center.

(This

step

is

optional;

you

do

not

needto

archive

orders.)

There

are

two

ways:Log

in

to

your

Merchant

Center

account.Level

2

only:

If

you

have

implemented

the

Order

Processing

API,

you

can

sendan

archive-order

command

to

Google.

The

XML

below

shows

a

sample

archive-

order

command:51Typical

Order

Flow52

Figure

1:

An

order

is

placed

by

a

customer,

accepted

by

themerchant

and

the

customer

is

charged.

Figure

2:

The

merchant

processes

the

order,

ships

the

order,

andthen

archives

the

order

after

it

has

been

delivered

to

the

customer.5354Credit

Card

Authorization

andCapture55After

a

new

order

is

confirmed

by

the

buyer,

Google

will

attempt

to

authorize

thebuyer"s

credit

card

for

the

full

order

amount.

If

the

authorization

succeedsandtheorder

passes

Google"s

risk

checks,

the

order"s

financial

order

state

will

be

updated

toCHARGEABLE.

If

the

authorization

fails,

Google

will

email

the

buyer

to

request

anew

credit

card.

If

the

buyer

supplies

a

new

credit

card,

Google

will

try

to

authorizethat

card.

However,

if

the

buyer

does

not

supply

a

new

credit

card

within

72

hoursafter

the

email

is

sent,

Google

will

cancel

the

order.After

payment

has

been

authorized,

youcan

charge

the

order

for

any

amount

up

tothe

authorizedamount.You

can

continue

charging

an

order

until

all

authorized

fundshave

been

captured.Merchants

can

instruct

GoogleCheckoutto

automatically

charge

orders

as

soon

asthey

become

chargeable.Authorizing

Payment

beforeShipping

ItemsWhen

a

customer

places

an

order,

the

new

order

will

appear

in

your

Inbox

in

your

Merchant

Center

account.

When

the

order

is

submitted,

the

listing

for

that

order

in

your

Merchant

CenterInbox

will

display

a

status

of

Reviewing.

As

long

as

the

order"s

status

is

Reviewing,

you

will

not

beable

to

charge

the

customer

for

the

order.

During

this

time,

Google

Checkout

will

authorize

thecustomer"s

credit

card

for

the

amount

of

the

purchase.After

the

payment

has

been

authorized,

the

order"s

status

will

update

from

Reviewing

to

New.

Youshould

not

ship

the

ordered

items

to

the

customer

until

the

order"s

status

has

updated

to

New.After

that

time,

you

will

also

have

the

option

to

charge

the

customer

for

the

order.

To

charge

thecustomer,

you

would

click

the

Charge

button

that

appears

next

to

the

order

in

your

MerchantCenter

Inbox.Level

2

only:

If

you

have

implemented

the

Order

Processing

and

Notification

APIs,

you

should

notship

ordered

items

unless

you

have

received

the

following

three

notifications

for

the

order.The

new

order

notificationThe

risk

information

notificationThe

order

state

change

notification

informing

you

that

the

order"s

financial-order-state

has

been

updated

toCHARGEABLE56Others..57Reauthorizing

a

Customer"s

Credit

CardBuyer

Refund

RequestPosting

XML

Messages

to

Google58/checkout/cws/v2/Merchant/1234567890/checkout

/cws/v2/Merchant/1234567890/checkoutGuidelines

for

XML

API

RequestsSpecify

UTF-8

encoding

by

including

the

following

line

at

the

start

of

each

XML

API

request:<?xml

version="1.0"

encoding="UTF-8"?>To

include

the

XML

reserved

characters

&,

<,

and

>

in

an

XML

element

value,

you

must

encodethe

characters

as

hexadecimal

numeric

character

references.The

following

table

shows

the

numeric

character

references

for

these

characters:You

can

use

all

other

UTF-8

characters

directly.Googlewill

not

render

HTML

tags

that

you

include

in

XML

element

values.

If

you

pass

HTML

tags,such

as

in

the

<item-name>

and

<item-description>

elements,

Google

will

remove

the

HTML

tagsand

display

the

text

without

formatting.Unless

otherwise

noted,

string

elements

in

Google

Checkout

are

not

limited

to

any

particularlength.59Internationalization60

Google

Checkout

includes

the

following

internationalization-readyfeatures:All

XML

messages

betweenyouand

Google

Checkout

use

UTF-8

(Unicode)encoding.Time/date

values

use

the

ISO

8601

standard,

which

specifies

time

as

an

offsetfrom

UTC.All

money

elements

have

a

currency

attribute.Immediate

(Syn

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论