•
•
•
•
•
•
TableofContents
Index
Reviews
ReaderReviews
Errata
Academic
PayPalHacks
ByDaveBurchell,DavidNielsen,
ShannonSofield
Publisher :O'Reilly
PubDate :September2004
ISBN :0-596-00751-5
Pages :368
LearnhowtomakethemostofPayPaltoget
themostoutofyouronlinebusinessor
transactions.Fromhowtotakestepsto
protectyourselfwhilebuyingandsellingon
eBaytousingPayPalonyourownsiteto
handlesubscriptions,affiliations,and
donations,PayPalHacksprovidesthetools
anddetailsnecessarytomakePayPalmore
profitable,moreflexible,andmore
convenient.
•
•
•
•
•
•
TableofContents
Index
Reviews
ReaderReviews
Errata
Academic
PayPalHacks
ByDaveBurchell,DavidNielsen,
ShannonSofield
Publisher :O'Reilly
PubDate :September2004
ISBN :0-596-00751-5
Pages :368
Copyright
Credits
AbouttheAuthors
Contributors
Acknowledgments
Preface
WhyPayPalHacks?
GettingStartedwiththeCodeinThisBook
FurtherStudy
HowThisBookIsOrganized
DatabaseCodingandPlatformChoices
HowtoUseThisBook
ConventionsUsedinThisBook
UsingCodeExamples
HowtoContactUs
GotaHack?
Chapter1.AccountManagement
Introduction:Hacks#1-9
Hack1.CreateaPayPalAccount
Hack2.VerifyYourPayPalAccount
Hack4.PayWhenYou'veForgottenYourPassword
Hack6.CreateaSeparateLoginforEachEmployee
Hack8.ManagePayPalEmail
Hack3.ConfirmYourMailingAddress
Hack5.RestoreYourAccountifItHasBeenLimited
Hack7.AccessMemberInformation
Hack9.GetHelpfromPayPal
Chapter2.MakingPayments
Introduction:Hacks#10-16
Hack10.SendMoneytoAnyone
Hack11.ChooseHowtoFundPayments
Hack13.PayfromaCellPhone
Hack15.SendMoneyWithoutCreatingaPayPalAccount
Hack12.UseYourPayPalFundsAnywhere
Hack14.PaySellerFeeswhenBuying
Hack16.DisputeMerchandisePayments
Chapter3.SellingwithPayPal
Introduction:Hacks#17-27
UpgradetoBusinessClass
SetYourPaymentReceivingPreferences
Hack17.RequestMoneythePayPalWay
Hack19.RequestMoneyWithoutanAccount
Hack21.RefundaPayment
Hack23.LowerYourSellerFees
Hack25.ProtectYourselffromChargebacks
Hack27.HandleMerchandiseDisputesEffectively
IdentifyYourselftoYourCustomers
Hack18.AskforMoneyinYourOwnWay
Hack20.GetYourMoney
Hack22.Quick-LinktoTransactionDetails
Hack24.ProtectYourselffromBuyerFraud
Hack26.AvoidChargebacksonDigitalGoods
Chapter4.PaymentButtons
Introduction:Hacks#28-44
Hack29.UseaCustomButtonImage
Hack31.CreateanAuctionPaymentButton
Hack33.IncludeMoreThanTwoOptionFields
Hack35.BuildNotificationTracking
Hack37.Hack-ProofYourButtonswithEncryption
Hack39.HideYourEmailAddressfromSpammers
Hack41.PayPal-EnableYourFlash
Hack43.ProvideOptionswithASP.NETWebControls
Hack28.CreateaBuyNowButton
Hack30.CreateaPurchaseButtonforServices
Hack32.ProvidePurchaseOptionswithDrop-DownListboxes
Hack34.OverrideShippingandHandlingPreferences
Hack36.Hack-ProofYourPayment
Hack38.IncludePaymentButtonsinEmailMessages
Hack40.AcceptDonations
Hack42.GetMoreOutofDreamweaverandPayPal
Hack44.TryAcceptingPaymentsinaBogusCurrency
Chapter5.StorefrontsandShoppingCarts
Introduction:Hacks#45-50
Hack45.HackShoppingCartButtons
Hack46.CreateShoppingCartLinks
Hack48.DealwithDesignandLayoutIssues
Hack50.IntegrateaThird-PartyShoppingCartwithPayPal
Hack52.DisplaytheMerchantTransactionIDonYourReturnPage
Hack54.CreateaDynamicStorefront
Hack56.InsertDynamicImages
Hack58.OfferDiscountCoupons
Hack47.SpecifytheSizeoftheShoppingCartWindow
Hack49.PutBothCartButtonsinOneForm
Hack51.CustomizeCheckoutPages
Hack53.RememberYourCustomers
Hack55.AddDynamicStorefrontDetails
Hack57.BuildanOrder-TrackingPage
Hack59.IncreaseSearchEngineExposure
Hack60.SellDigitalGoodswithPayLoadz
Chapter6.ManagingSubscriptions
Introduction:Hacks#61-64
Hack61.SellSubscriptionstoYourOnlineContent
Hack62.OfferTieredSubscriptions
Hack63.TimeYourSubscriptionstoEndonSpecificDates
Hack64.ManageSubscriptionPasswordstheEasyWay
Chapter7.IPNandPDT
Introduction:Hacks#65-86
WhatIPNandPDTAre
AdvantagesofPDT
Hack66.TroubleshootInstantPaymentNotifications
Hack68.ProcessShoppingCartswithIPN
Hack70.TrackYoureBayProductswithIPN
Hack72.DeliverDigitalGoodswithaReturnPage
Hack74.ProvideanOrderSummarywithIPN
Hack76.EnableMultipleIPNPages
Hack78.ManageYourInventorywithIPN
Hack80.DisplayaRecentDonorList
Hack82.InsertPaymentDetailsintoaDatabasewithIPN
Hack84.TrackGoogleReferrals
HowIPNWorks
Hack65.ReceiveInstantPaymentNotifications
Hack67.SendaPurchaseConfirmationEmailwithIPN
Hack69.UseIPNwitheBayListings
Hack71.DeliverDigitalGoodswithIPN
Hack73.ImplementPriceCheckingwithIPN
Hack75.UpsellYourCustomers
Hack77.UseMassPaytoCreateanAffiliateSystem
Hack79.DisplayDonationGoalsonYourWebSite
Hack81.CaptureCustomerInformationwithIPN
Hack83.InsertCartDetailsintoaDatabase
Hack85.ProcessPaymentslikeaCreditCardwithPDT
Hack86.SynchronizingPDTandIPN
Chapter8.ThePayPalWebServicesAPI
Introduction:Hacks#87-100
Section8.2.CreateaDeveloperAccount
Hack88.MakeYourFirstAPICall
Hack90.UsethePayPalAPIWrapperClass
Hack87.SetuptheSandbox
Hack89.CreateaWrapperClassforYourAPICalls
Hack91.RefundPaymentswiththeAPI
Hack92.HandleTransactionErrorswithintheAPIWrapper
Hack93.RetrieveTransactionDetailswiththeAPI
Hack95.HacktheAPIWrapper
Hack97.PayAffiliatesandSuppliersonaSchedule
Hack99.TestIPNandPDTintheSandbox
Hack94.SearchforPayPalTransactions
Hack96.IssuePaymentsenMassewiththeMassPayAPI
Hack98.SearcheBayforListingsthatAcceptPayPal
Hack100.GoLive
Colophon
Index
Copyright©2004O'ReillyMedia,Inc.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles().Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938or
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
TheHacksseriesdesignations,PayPalHacks,theimageofa
moneychanger,"Hacks100Industrial-StrengthTipsandTools,"
andrelatedtradedressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorsassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.
Smallprint:Thetechnologiesdiscussedinthispublication,the
limitationsonthesetechnologiesthattechnologyandcontent
ownersseektoimpose,andthelawsactuallylimitingtheuseof
thesetechnologiesareconstantlychanging.Thus,someofthe
hacksdescribedinthispublicationmaynotwork,maycause
unintendedharmtosystemsonwhichtheyareused,ormay
notbeconsistentwithapplicableuseragreements.Youruseof
thesehacksisatyourownrisk,andO'ReillyMedia,Inc.
disclaimsresponsibilityforanydamageorexpenseresulting
fromtheiruse.Inanyevent,youshouldtakecarethatyouruse
ofthesehacksdoesnotviolateanyapplicablelaws,including
copyrightlaws.
Credits
AbouttheAuthors
Contributors
Acknowledgments
AbouttheAuthors
ShannonSofieldisthepersonificationofahack:hetakes
anythingthatissupposedtodoonethingandmanipulatesitto
servehisownpurposes,inbothhislifeasadeveloperandhis
lifeingeneral.Ifitwasoriginallysupposedtodoonething,he
probablyhasitdoingsomethingentirelydifferent.Shannon
begancreatingPayPalsolutionsmorethanthreeyearsago
usinghisoriginaldatabase-drivenPayPalpurchasesystemthat
integratedwithMacromediaDreamweaverUltraDev.Sincethen,
hehasgoneontoimplementuniquefixesforcommon
eCommerceproblemsusingPayPal.Hehaswrittenseveral
tutorialsandarticlesandhasspokenonthetopicofusing
PayPalinnewways.OneofthefirstmembersofthePayPal
DeveloperNetwork,hewasaddedtothePayPalDeveloper
NetworkAdvisoryBoardsonitsinception.Healsoserved
severaltermsasamemberofTeamMacromediafortheirweb
developmentprogramDreamweaver,whichheusesinhisdaily
PayPaldevelopment.Histechnicalbackgroundextendsbackto
theinitialInternetboom,whenhebeganpickingupsimpleweb
designthatevolvedintowebplanningandprogrammingusinga
varietyoftechnologies,languages,anddatabases.Currently,he
managesthePayLoadzDigitalGoodseCommercesystemthat
allowsmerchantstoselldigitalgoodssecurelywithPayPal.One
ofthefirstandmostsuccessfulthird-partysolutionsforPayPal,
thissystemmadeheadlineswhenitlaunchedMadonna's
"AmericanLife"singlehigherontheBillboardmusicchartsthan
anypreviousdigitalsingle(andhediditbeforesellingdigital
musicwascool).Inaddition,hecontinuallycontributestothe
PayPalDeveloperNetworkMessageBoards
(),whichhiscompany,Superfreaker
Studios,hostsandmaintains.Whenhe'snotsloggingthrough
codeathiscomputerinacaffeinated,sleep-deprivedstate,
Shannonenjoysoutdooractivitiesthatfitthetimeofyear.In
thesummer,hesurfsandvolunteersforthesurfboard
manufacturerWaveRidingVehicles;inthewinter,hecanbe
foundontheslopes,workingonhiskickerspins.Year-round,he
canbefoundrelivinghisBMXdaysonhis24"GTcruiser.Inhis
undergraduatestudies,ShannonmajoredinFinanceand
Accounting,whilehisMastersinBusinessAdministration
includesaconcentrationinFinance.Ctrl-Cishisbestfriend.
DaveNielsenisaTechnicalEvangelistwithinthePayPal
DeveloperNetwork,amemberofSDForum'sExecutiveCouncil,
andthefounderoftheWebServicesSIGofSiliconValley.Dave
hasaBachelorofSciencedegreeinBusinessfromCalPoly,San
LuisObispoandisarmedwithaneducationinengineeringand
marketing,aswellasmanytechnicalcertifications.Asa
technicaltrainerintheearly'90s,Davetaughtclassesin
languagessuchasVisualBasic,SQLandASP.Davewasan
earlyInternetprogrammingenthusiastandfoundhimself
houndingMicrosoftfordata-drivenwebdevelopertools.After
takingachanceonearlybetaversionsofIISandActiveServer
Pages,Davebecameoneofthefirsttechnicaltrainerscertified
toteachthenowpopularASPtechnology.AtPayPal,Dave
focuseshiseffortsoncreatingtoolsthathelpdeveloperscreate
greateCommercewebsites.Theseprojectsincludethe
PaymentRequestWizard,theJavaScriptButtonFactory,the
PayPalSDKforASP.NETandthePayPalCommerceStarterKit.
Davecanbefoundonlineat,at
conferences,and"competing"inanoccasionaltriathlon.At
home,hisgirlfriendtriestostophimfromsellingeverythinghe
ownsoneBay.
DaveBurchellgothisstartwithcomputersbyprogrammingthe
RadioShackTRS-80inBASICandtheCommodore64in6510
assembly.Currently,Dave'sfavoriteprogramminglanguages
arePerlandXSLT.AferventproponentofXML,Daveenjoys
solvingcontentmanagementproblemswithmarkupandopen
sourcesoftware.HisotherinterestsincludeAmericanhistory
andHellenisticphilosophy.Daveliveswithhiswife,Renee,and
children,Max,Gus,andSamanthaGrace,inLincoln,Nebraska.
Contributors
Thefollowingpeoplecontributedtheirwriting,code,and
inspirationtoPayPalHacks:
PaulamBaldwinisaPayPalDeveloperTechnicalSupport
Agent.ShestartedatPayPalinJuly2003.Paulamholdsa
B.S.inComputerScience.Shegotherstartwithcomputers
bycreatinganintranetworkflowmodule,writtenin
JavaScriptandserver-sideJavaScript,forstudents
reapplyingtotheCentralUniversityofVenezuela.Paulam
enjoysorigamiandlearningabouttheworld'scultures.She
believesthatmakingpeoplehappyisthebestwaytolive
life.
LoyalBassettisoneofthemanycontentprogrammersin
thePayPalFraudEngineeringgroup.Hehasbeendiligently
workingatPayPalforovertwoyears.Heenjoyscyclingand
hisfriendlycat,Mr.Kitty.
MichaelBlantonisaTechnicalIntegrationsManagerfor
PayPal,wherehehashelpedintegratePayPalintosuchsites
asB&HPhoto/Video()and
NewEgg.com().Priortojoining
PayPal,MichaelwasanArchitect/DeveloperforCyberSource
ProfessionalServices.AtPayPal,Michaelnotonlyhelps
integratethePayPalPaymentSolutionintotheirlargest
merchants,buthealsohelpsdevelopnewproductideas
thatworkforenterprise-classcustomers.Athome,he
focusesallofhiseffortsonhiswife,son,andhisson's
LEGO.
PatrickBreitenbach,aBayAreanative,spentoverfour
yearsasaUCSBGauchoandoversixyearsatAmerican
ExpressinNewYorkbeforereturningtoSanFranciscofive
yearsagotoworkatX.com(nowknownasPayPal).Patrick
isamanagerofthePayPalDeveloperNetwork
(Heenjoysmountainbiking,
magazines,gadgets,andallthingsApple.
MayChenisaProductManagerwithintheConsumer
ProtectionsProductteam.MayhasaBachelorofScience
degreeinBusinessfromWashingtonUniversityinSt.Louis,
MO.PriortoPayPal,Mayworkedforafinancialservices
companyandalsoforanonlinepaymentprocessing
company.AtPayPal,Maypreviouslywasapartofthe
CustomerServiceandOperationsProductTeam,primarily
focusingoninternalcustomerservicetoolsforPayPal's
contactcenters.NowontheConsumerProtectionsteam,
Mayfocusesonproductstoimprovedisputeresolution
processes.
RobConeryisaMicrosoftCertifiedTrainerandSolutions
DeveloperwhohasbeenusingMicrosofttechnologiesfor
thelast14years,architectingandbuildingenterprise
applicationsforFortune500companiessuchasSBC,KLATencor,andWekeRoad.Robhasbeendescribedbyhis
clientsasbothinnovativeandcolor-blind;oneclientlikened
hisskillsettothatofahomelessperson'sshoppingcart,
whichheisstilltryingtounderstand.Priortospinningthe
twirlyonhisnerdhat,Robpretendedtobeageologist
whilehoggingVAXtimeinthecomputerlabathisalma
mater,UCSantaBarbara.Itisbelievedthathisfinalforhis
Pascalclassisstillcompiling.
SouvikDashasaMaster'sdegreeinComputerScience.He
startedhisengineeringcareerinacompanydoingresearch
onsecuritypolicies.Hehasworkedinvariousengineering
positionsatNetscape,AOL,andPayPal.Hisinterestsliein
buildinghighlyscalable,available,andreliableInternet
applications.Outsideofwork,helovestospendtimewith
hissonandlistentoHindustaniclassicalmusic.
GlennEllingsonisabold,strappingyoungmanwhospends
adisturbingamountoftimeplayingwithcars.Tofundthis
ratherunfortunatehabit,healsoplayswithcomputers.He
hascontributedtofinancialapplicationsinVermont,
multiplayergaminginMassachusetts,document
managementsoftwareinIllinois,telephonyinFlorida,and
nowonlinepaymentsinCalifornia.Hereportsmixed
feelingsthatGooglinghisnamerevealshehas"killed
billionsofsentientbeingsandshouldbetreatedwith
utmostcaution."
GinaHanisaproductmanageratPayPal,specializingin
consumerprotectionsprogramsforbuyersandsellers.This
involvesonlinedisputeresolutiontohelpthecommunity
resolveissuesaroundmerchandisetransactions.Ginahasa
longhistoryofhelpingpeople,developingane-mentoring
programforsciencestudents,givingteensawaytoshop
online(okay,maybethiswasn'texactlyaltruistic),and
buildingsoftwarethatenabledpeopletotracetheirfamily
trees.Herhobbiesdonotincludekaraoke,taxidermy,or
participatinginhotdog-eatingcontests.
StephenIvaskeviciusisthePayPalDeveloperTechnical
SupportSupervisorwhostartedatPayPalinJanuaryof
2001andcurrentlysupportsPayPalWebServices.Stephen
hascontributedtotheenhancementsofmanyPayPal
featuresovertheyears.Hehasastronginclinationfor
eatingcheeseburgersinparadise,searchingforlostshakers
ofsaltonhismotorcycle,andshouting"Finsup!"atthetop
ofhislungs.
DavidA.Karpjustlikestoseehisnameinprint.Inaddition
tobeingtheeditorforthisbook,DavidistheauthorofeBay
Hacks,theupcomingeBayPowerSeller:TheMissing
Manual,andthebest-sellingWindowsAnnoyancesseries
(thelatestinstallmentofwhichisWindowsXPAnnoyances).
Hisbooksarecurrentlyavailableintendifferentlanguages,
andhisonlinehelpsite,Annoyances.org,isoneofthemost
popularofitskind.Hehasalsowrittenforanumberof
magazinesincludingPCMagazine,WindowsSources
Magazine,WindowsProMagazine,andNewMedia
MagazineandheisacontributingeditorforZTrack
Magazine.NotedrecognitionincludesPCComputing
magazine,WindowsMagazine,theSanFranciscoExaminer,
andTheNewYorkTimes.HeusesPayPalasameansto
acquiremorejunkoneBay.
SarahLivnatisaPayPalProductManagerwhohasworked
withLimitedAccountAccessandmanyofPayPal's
complianceandriskproducts.PriortojoiningPayPal,Sarah
wasaProductManageratChemdex/Ventro,aB2B
marketplaceapplicationserviceprovider.Sarahisanavid
worldtraveler,justhavingreturnedfromayear-long
expeditiontoSouthernAfrica,Nepal,SoutheastAsia,and
theOceana.
JosephLowery'sbooksontheWebandweb-buildingtools
areinternationalbestsellers,havingsoldmorethan
300,000copiesworldwideinninedifferentlanguages.Heis
theauthoroftheDreamweaverBibleandtheFireworks
Bibleseries(bothfromWileyPublishing),andhe
coauthoredDreamweaverMX2004WebApplicationRecipes
(NewRiderPublishing)withEricOtt,presidentofWebAssist
().WebAssististheleading
providerofextensions(softwareadd-ons)forthe
Macromediaplatform.WebAssisthostsaself-service
developercommunitywithover100,000members
registered.WebAssist'spartnersincludeMacromedia,
PayPal,Affinity,Yahoo!,andGoogle.
DaveLundvallisaSeniorSalesConsultantforOracle,
specializinginOracle'sApplicationServer10g.Hehasa
BachelorofSciencedegreeinComputerSciencefromthe
UniversityatBuffalo.Davebeganprogrammingsoonafter
hisfamilypurchasedaCommodore64inthemid`80s.
NowDavehasexperiencebuildingeverythingfrommobile
phoneapplicationstoenterpriseportals.BeforeDave
movedintotheJ2EEworld,hewasevenonceaMicrosoft
CertifiedSolutionsDeveloper(MCSD).AcoupleofDave's
interestsoutsideofsoftwarearecompetingintriathlonsand
volunteeringforTeaminTraining,whichraisesfundsforthe
LeukemiaandLymphomaSociety.Davecanbereachedat
DaveMcClureisDirectorofthePayPalDeveloperNetwork
(andalsoacurrentgeekand
formerentrepreneur().His
interestsandhobbiesincludefinanceandeconomics,
entrepreneurshipandventurecapital,jazzandbaroque
music,politicsandbusiness,numeroussportsandgames,
ultimateFrisbee,cartoonsandanimation,andanevergrowingcollectionoffunny-lookinghats.Daveisahugefan
ofDr.Seuss,TheEconomist,andtheMuppets,andlivesin
theSanFranciscoBayAreawithhiswife,Saya,atalented
jazzpianistandcomposer().
JeffreyMcManusisaSeniorManagerofDeveloperRelations
ateBayandhasover15yearsofexperienceasadeveloper,
technologymanagerandtechnicalwriter.Heisproficientin
manydevelopmenttechnologiesandhaswrittensixbooks,
includingtheC#Developer'sGuidetoASP.NET,XML,and
ADO.NETandtheVB.NETDeveloper'sGuidetoASP.NET,
XMLandADO.NET(bothfromAddison-Wesley).Inhisspare
time,Jeffreyenjoyshelpinghighschoolkidsbuildrobotsfor
competitions.
EvanMcPhillipsisaProductIntegrationSpecialistforPayPal
andhasworkedwithPayPalforalmosttwoyears.He
startedinMemberServices,thenmovedtoResolution
ServicesasaCustomerServiceRepresentative,thenmoved
toProtectionServicesasaSellerProtectionAgent,andhas
beeninhiscurrentpositionforthelastcoupleofmonths.
Hehasover10yearsinthecustomerserviceindustry.Evan
hasaBachelorofArtsdegreeinReligiousStudiesandisan
avidreaderofsciencefictionandfantasynovelsandan
Everquestjunkie.
HugoOlliphantisaPayPalProductManagerwhohasworked
witheBayGiftCertificates,Merchant-InitiatedPayment,and
manyofPayPal'sreportingtools.PriortojoiningPayPal,
HugowastheCEOofgMoneyCorp,acompanythat
providesfinancialmanagementsolutionsforgroups
involvingroommates,skihouses,carpools,andthelike.
Hugohasapenchantforpolarexplorationliteratureand
dinosaurorigami.
PatrickO'NealisaPayPalTechnicalSupportSeniorAgent
whohasworkedprimarilywithsupportingPayPal's
MerchantFeatures(e.g.,websitepaymentbuttons,IPN,
andPDT).BeforeworkingatPayPal,PatrickwasaCustomer
ServiceAnalystwithAmeritrade.Patrickholdsan
Associate'sdegreeinComputerNetworkSystemsanda
BachelorofSciencedegreeinComputerSciencewithan
emphasisonWebProgramming.Inhisfreetime,Patrick
enjoyswritingandproducinghip-hopmusicandlearning
newprogramminglanguages.
RayTanakaistheTechnicalArchitectforthePayPal
SandboxandWebServicesAPIs.PriortojoiningPayPal,Ray
waswithSkyGo,Inc.(nowknownasEnpocket),workingon
wirelessmarketingsolutions.Hishobbiesincludesleeping,
foosball,racquetball,andspendingtimewithhisgirlfriend.
AlanTienisaPayPalGlobalProductManager.Hisprimary
claimtofameisreleasingPayPal'sWebServices.Priorto
PayPal,AlanwasaSeniorProductManagerattheASP
aggregatorJamcracker,a$140Mdotcomflameout.Before
theInternetera,AlanwasaconsultantatWESTTand
Accenture(thenknownasAndersenConsulting).He
graduatedfromStanfordwithaBachelorofSciencedegree
inElectricalEngineeringbutcarefullyavoidedanycareer
thatwouldactuallyusehiseducation.
KatherineWooisaDirectorofProductManagementat
PayPal,whereshemanagestheMerchantFeaturesProduct
Team.Herpriorexperienceincludesproductmanagement
atNetscape(AOL),strategyconsultingatMercer
ManagementConsulting,andanMBAfromStanford.She
dreamsonedayofmakingalineofgreetingcardsor
designingwinelabels.
MikeYeung,aDevelopmentArchitect,isresponsiblefor
providingtechnicalleadershipandprojectmanagementfor
majorintegrationprojectsatGrandCentral.Mikehasover
12yearsofexperienceinsoftwaredevelopmentand
technicalmanagement.Hehaspreviouslyworkedat
companiessuchasChinadotcom,Netscape,andOraclein
varioustechnicalandmanagementpositions.Mikeholdsa
MasterofSciencedegreefromStanfordUniversityanda
BachelorofSciencedegreefromUC,Berkeley,bothin
ComputerScience.
Acknowledgments
TheauthorsandcontributorswishtothankRaelDornfest,Kyle
Hart,andDanWoods.JamiePeppard,BrianSawyerandDarren
Kellywereinstrumentalincleaningupourworkforthisbook.
ShannonSofield
I'dliketothankthePayPalteamforcreatingagreatservice
andfortheirsupportthroughoutthisprocess.Ialsowouldlike
tothankthe"Daves"thathelpedgetthisbookwritten:Dave
McClure,forbeingtherefromthebeginning,DavidA.Karpfor
puttingupwithmywritinghabits,DaveNielsenforhisexpertise
andmanagement,andDaveBurchellforsteppingupand
helpingusgetthisoutthedoor.Also,thankstomyparentsand
friendsfortheirmotivation.
DaveNielsen
I'dliketothankPayPalians,pastandpresent,forcreatingthis
awesomepaymentplatform;DaveMcClure,myPDNmentor,for
takingmeunderhiswing;PB,forhismasteryofthemultitude
ofPayPal'sintricatefeatures;DavidA.Karp,cat-wrangler
extraordinaire,forhisencouragementandperseverance;Mom
andbrotherMarkforputtingupwithmyquestforanswersto
life'spersistentquestions;Dadforleavingmehiswacky
inventiveness;andErika,myinspiration,whomakesmesmile
everyday.Erika,Ifeelsoluckytohavefoundyou.Withyou,
everydayisbeautifulandnew.Nothingwouldmakemehappier
thantospendtherestofmylifewithyou...ErikaAnderson,will
youmarryme?
DaveBurchell
Iwishtoextendmythankstothemanycoworkerswho
assistedmewhileworkingonthisbook,includingPaulam
Chang,DebbieBecker,ClaudiaErickson,StephenIvaskevicius,
WarrenLynch,PatrickO'Neal,MichelleTaylor,PatriciaTruit,and
KimWeiss.MythanksalsotomarketingmavenEvelyn
SchlaphoffofSourceLink/LosAngeles,guruMikeLewisofThe
WorldBook,andtoourmasterful,patient,anddedicatededitor,
DavidA.Karp.
Preface
PayPalwasn'tthefirstcompanytobuildanonlinepayment
system,butitmightaswellbethelast.Withover50million
registeredaccounts,PayPalisrapidlybecomingahousehold
name.But,asindicated,therehavebeenothers;PayPal's
predecessorsattemptedtocapitalizeontheInternetboomby
buildingnewformsofmoney.Butwhetherthisnewcurrency
wascalledFlooz,Beanz,oreCash,itdidn'tmatter,because
peopledidn'tbuyit.PayPalbaseditssystemonplainolddollar
bills(nottomentionyen,euros,andpoundssterling),which,in
theend,turnedouttobemorevaluablethanInternetgold.
PayPal'snextbrilliantmovewastoidentifyeachaccountbyan
emailaddress.Thatway,anyonewithanemailaccountcould
sendmoneytoanyoneelsejustbyknowingtherecipient's
emailaddress.Theemailproclaiming"You'vegotcash"turned
outtobeextremelymotivating.
Fromitsbeginning,PayPalempoweredthelittleguytocompete
inthebigworld.ItmadedoingbusinessovertheInterneteasy
forindividuals,whocouldattachtheirbankaccountstotheir
PayPalaccountswithoutrequiringaCFO'ssignature.Andthe
littleguyreturnedthefavor.Afterall,itwasthelittleguyswho
pavedthewayforPayPaltobecomethenumberonepayment
systemoneBay.
PayPalalsoremovedthetechnicalchallenges.PayPalmadeit
possibleforanHTMLdevelopertoacceptonlinecreditcard
paymentsfromanywebpagewithoutrequiringtheyearsof
programmingskillsnecessarytoinstallcreditcardprocessing
softwareonawebserver.AsimplePayNowbuttoninaneBay
auctionpagebecameasempoweringasthemostexpensive
eCommercesiteontheInternet.
Fordevelopers,itdidn'tstopthere.BuyNow,Donate,Addto
Cart,andSubscriptionbuttonsmakeInternetcommerceinall
flavorspossible.AndwithinnovationssuchasWebsite
Payments,InstantPaymentNotification,andPayPalWeb
Services,allthepowerofthiseCommercegiantisonlyafew
linesofcodeaway.It'snotsurprisingthatPayPalisbeing
toutedasthepaymentplatformofthefuture.Butforthosewho
learnwhatitcanalreadydo,itmaymeanmakingprofitstoday!
WhyPayPalHacks?
Thetermhackinghasabadreputationinthepress.Theyuseit
torefertosomeonewhobreaksintosystemsorwreakshavoc
withcomputersastheirweapon.Amongpeoplewhowritecode,
though,thetermhackreferstoa"quick-and-dirty"solutiontoa
problem,oracleverwaytogetsomethingdone.Andtheterm
hackeristakenverymuchasacompliment,referringto
someoneasbeingcreativeandhavingthetechnicalchopsto
getthingsdone.TheHacksseriesisanattempttoreclaimthe
word,documentthegoodwayspeoplearehacking,andpass
thehackerethicofcreativeparticipationontotheuninitiated.
Seeinghowothersapproachsystemsandproblemsisoftenthe
quickestwaytolearnaboutanewtechnology.
Asanyexperiencedmerchantwilltellyou,thereareplentyof
tasksinvolvedinacceptingpaymentsontheInternet,and
anythingthatcanbedonetomakethosetaskseasier,faster,or
moreeffectivewillimproveyourprofitsandgiveyoumoretime
togrowyourbusiness.ButdespitethetitlePayPalHacks,this
bookisalsonotabout"hackingintoasystem"oranythingso
nefariousquitethecontrary.Infact,you'llfindinthisbooka
veryrealemphasisontradingresponsiblyandethically,aswell
asextensivetoolsandtipsforprotectingyourselfasbotha
buyerandaseller.
PayPal,onthesurface,seemslikeasimplesystemallowingyou
tosendandreceivepayments.Butthere'sawholelotmore
underthehood;therearemanytipsandtricksyoucanuseto
savetimeandimprovesaleswithPayPal.Thehacksinthisbook
addressthetechnologicalanddiplomaticchallengesfacedbyall
PayPalmembers,andarewrittenfromtheperspectivesofboth
PayPalinsidersandexperiencedsolutionproviders.Essentially,
you'llfindthetoolstohelpyoubuyandsellsmarterandsafer,
makemoremoney,andhavefundoingit.
GettingStartedwiththeCodeinThisBook
Thesamplecodeinthisbookshouldserveasagoodjumpingoffpointforhoweveryouwanttouseeachhackinthereal
world.Tothatend,PayPalHacksprovidesrealcodeyoucan
typeinandrunyourself.
PayPal'shomeistheWeb,aheterogeneousplacegovernedby
well-definedstandards.Theconceptspresentedinthisbook
workwithanyprogramminglanguageorplatformyoumightbe
usingwithyourwebsite.However,theexamplecodeis
primarilykepttothreelanguageandplatformcombinations,
eachinhabitingitsownnicheoftheInternetecology:serversidescripting,client-side(browser)scripting,anddesktop
applications.
Server-SideScripting
Server-sidescriptsareinstalledonawebserver.Whenauser
requestsawebpagethatcontainsaserver-sidescript,the
scriptisprocessedonthewebserveranditsoutputis
convertedtoHTMLanddeliveredtotheenduser'swebbrowser.
Mostofthehacksinthisbookthatinvolveserver-sidescripting
arewritteninVBScript(VisualBasicScript),whichrunsona
webserverwithsupportforMicrosoftActiveServerPages
(ASP).TheASP/VBScriptcombinationisoneofthemost
popularplatformsamongwebmastersanddevelopersusing
Microsoftsystems.Microsoft'snewestwebplatform,ASP.NET,is
growingrapidly;itisbackward-compatibleandwillalsorun
ASP/VBScriptcode.
YoucanhosttheVBScriptexamplesusingamodernMicrosoft
operatingsystem,suchasMicrosoftWindowsXPProfessional,