Express Checkout Integration Guide
Express Checkout Integration Guide
Integration Guide
© 2009 PayPal, Inc. All rights reserved. PayPal is a registered trademark of PayPal, Inc. The PayPal logo is a trademark of PayPal, Inc. Other
trademarks and brands are the property of their respective owners.
The information in this document belongs to PayPal, Inc. It may not be used, reproduced or disclosed without the written approval of PayPal, Inc.
Copyright © PayPal. All rights reserved. PayPal (Europe) S.à r.l. et Cie., S.C.A., Société en Commandite par Actions. Registered office: 22-24 Boulevard
Royal, L-2449, Luxembourg, R.C.S. Luxembourg B 118 349.
Consumer advisory: The PayPal™ payment service is regarded as a stored value facility under Singapore law. As such, it does not require the approval
of the Monetary Authority of Singapore. You are advised to read the terms and conditions carefully.
Notice of non-liability:
PayPal, Inc. is providing the information in this document to you “AS-IS” with all faults. PayPal, Inc. makes no warranties of any kind (whether express,
implied or statutory) with respect to the information contained herein. PayPal, Inc. assumes no liability for damages (whether direct or indirect), caused
by errors or omissions, or resulting from the use of this document or the information contained in this document or resulting from the application or use
of the product or service described herein. PayPal, Inc. reserves the right to make changes to any information herein without further notice.
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Where to Go for More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
October 2009 3
Contents
4 October 2009
Contents
October 2009 5
Contents
6 October 2009
Preface
Intended Audience
This document is intended for developers and merchants implementing Express Checkout.
Revision History
Revision history for Express Checkout Integration Guide.
Date Description
6/04/2009 Added a chapter on pre-populating the PayPal review page. Updated PayPal
Review pages. Moved some customization topics out of this guide. They
are now in the Merchant Setup and Administration Guide.
Express Checkout is PayPal’s premier checkout solution, which streamlines the checkout
process for buyers and keeps them on the merchant’s site after making a purchase.
z The Express Checkout Experience
z Getting Started
z Express Checkout Flow
z Express Checkout Building Blocks
NOTE: For information about administrative tasks you can perform from your PayPal account
such as adding users, setting up custom page styles, and managing multiple currency
balances, see the Merchant Setup and Administration Guide. The guide is located on the
Documentation page linked to the Library tab on Developer Central.
process. The buyer can then proceed to review the order on your site. You can include other
necessary checkout steps. You can also up-sell to the buyer on your Review Order page.
The following diagram shows the Express Checkout flow:
Getting Started
You can implement Express Checkout in just four steps.
1. Place PayPal checkout buttons and PayPal payment mark images in your checkout flow.
2. For each PayPal button that you place, modify your page to handle the button click.
Use a PayPal API Express Checkout operation to set up the interaction with PayPal and
redirect the browser to PayPal to initiate buyer approval for the payment.
3. On your order confirmation page, obtain the payment authorization from PayPal and use
PayPal API Express Checkout operations to obtain the shipping address and accept the
payment.
4. Test your integration using the PayPal sandbox.
Because PayPal offers you the flexibility and opportunity to control your checkout process,
you should understand how your current checkout flow works and become familiar with the
Express Checkout flow. Start by reviewing Express Checkout Flow. For additional
background information that will help you get started, see Express Checkout Building Blocks.
Note that if your checkout flow omits the Merchant Review page and proceeds directly to your
Confirmation page, you can change the text on the PayPal Review page from Continue to Pay
Now. For details on how to change the text on the PayPal Review page from ‘Continue’ to
‘Pay Now’ see “User Confirms Order on PayPal” on page 67.
z On your Shopping Cart page, place the Check out with PayPal button and handle button
clicks by setting up the Express Checkout transaction and redirecting your buyer’s browser
to PayPal.
z On your Payment Methods page, associate the PayPal mark with an option. Handle
selection of the PayPal mark by setting up the Express Checkout transaction and
redirecting your buyer’s browser to PayPal.
z After returning from PayPal, complete the Express Checkout transaction by obtaining
shipping information from PayPal and accepting the payment.
To implement Express Checkout, you must place the following button on your Shopping Cart
page:
To implement PayPal as a payment option, which is part of Express Checkout, associate the
PayPal mark image with the option. Using a radio button, as shown in the image below, is the
recommended way to do this:
When you redirect your buyer’s browser to PayPal, you must specify _ExpressCheckout
command for Express Checkout. You also specify the token that identifies the transaction,
which was returned by the SetExpressCheckout API operation.
IMPORTANT: To enable PayPal to redirect back to your website, you must have already
invoked the SetExpressCheckout API operation, specifying URLs that
PayPal uses to redirect back to your site. PayPal redirects to the success URL
when the buyer pays on PayPal; otherwise, PayPal redirects to the cancel
URL.
If the buyer approves the payment, PayPal redirects to the success URL with the following
information:
z The token that was included in the redirect to PayPal
z The buyer’s unique identifier (Payer ID)
If the buyer cancels, PayPal redirects to the cancel URL with the token that was included in the
redirect to PayPal.
PayPal hosts the PayPal button and logo images that you use on your website. Using PayPal’s
buttons and logos is convenient and standardizes appearance on websites that use PayPal as a
payment option.
z About PayPal Button and Logo Images
z Dynamic Images
z Configuring the Dynamic Image
z Dynamic Image Command Reference
z Static PayPal Buttons and Images Source Requirements
The PayPal Acceptance Mark is the image you place on your payment methods page. It looks
like this:
z Static image
The dynamic images enable PayPal to change their appearance dynamically. If, for example,
you have signed up to participate in a PayPal campaign, PayPal can change the appearance of
the image dynamically for the duration of that campaign based on parameter information you
append to the image URL. By default, the Express Checkout images appears as shown above.
The static images cannot be changed dynamically. To participate in a PayPal campaign, you
would have to manually update the image code to change the image displayed and restore the
default image when the campaign is over. The only way you can have image management
taken care of for you is to replace static images in your implementation with dynamic images.
Dynamic Images
To use dynamic images, you must pass information to PayPal as parameters appended to the
image URL. Your unique ID tells PayPal whether or not you are participating in events that
require image changes. Other information you pass instructs PayPal on the types of images to
return.
If, for example, you are participating in a PayPal campaign that you have signed up for with
PayPal and you have passed the appropriate parameter information to PayPal, PayPal
automatically updates the image to reflect the campaign information. When the campaign is
over, PayPal restores the default image. You are not responsible for scheduling or making
changes to your website application code before, during, or after the campaign. It is all
handled for you when you set up the dynamic image.
If you require localized campaign images, you can have the localized button image display for
each country in which you participate. Simply assign the correct code for the country to the
locale parameter you append to the dynamic image URL. PayPal will return to the default
button image associated with each locale when the campaign is not available.
1. Append the pal parameter to the image URL, and set the parameter to the value of your
encrypted PayPal merchant account number.
https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-
image&pal=SFJCXFDLNFR5U
2. You can optionally change the value of LOCALE. See Change the Locale for details.
3. Place the URL with parameter information at the appropriate image locations in your web
application.
The pal alerts PayPal to campaigns in which you are participating. PayPal obtains this
information from your account and replaces the default image with the appropriate
campaign image during that campaign.
NOTE: If you pass in a pal value matching a merchant account that is not yours, PayPal
displays the image for that account. Be sure to pass the pal value matching your
account.
Locale Codes
The table below lists the locale values. Country code is the two-letter code for the country.
Language priority is the language associated with the country code where language_0 is the
default.
To get the HTML code for the PayPal Acceptance Mark image and for other general
information about images, change the command value in the URLs above to:
cmd=xpt/Marketing_CommandDriven/general/OnlineLogoCenter-outside
For example, to get the PayPal Acceptance Mark image for Poland, change the URL to:
https://www.paypal.com/pl/cgi-
bin/webscr?cmd=xpt/Marketing_CommandDriven/general/OnlineLogoCenter-outside
The PayPal API uses a client-server model in which your site is a client of the PayPal server.
z PayPal API Client-Server Architecture
z Obtaining API Credentials
z Creating an NVP Request
z Executing NVP API Operations
z Responding to an NVP Response
For example, you might want to obtain the customer’s shipping address from PayPal. You
could initiate a request that specifies an API operation that gets customer details. The response
from the PayPal API server would contain information about whether the request was
successful. If the operation was successful, the response would contain the requested
information; in this case, the customer’s shipping address. If the operation fails, there will be
one or more error messages.
Token Security
Typically, the API operation that sets up a redirection to PayPal returns a token, which is
passed as a parameter in the redirect to PayPal. The token also may be required in related API
operations.
IMPORTANT: You can use either a signature or a certificate; however, you cannot use a
signature and a certificate at the same time.
An API signature is a credential that consists of an API username along with an associated
API password and signature, all of which are assigned by PayPal.
To create an API signature
1. Log into PayPal and click Profile.
Make a note of the API username, API password, and signature. You will need to include
this information whenever you execute a PayPal API operation.
NOTE: The certificate you use for API credentials is not the same as an SSL certificate for
your website; they are separate entities and not related to each other.
The following diagram shows the API operation part of an NVP request:
A method specifies the PayPal operation you want to execute. Each method is associated with
a version number; together, the method and version defines the exact behavior of the API
operation. Typically, the behavior of an API operation does not change between versions;
however, you should carefully retest your code whenever you change a version.
To specify a method and version number
1. Choose the PayPal API operation you want to use.
METHOD=operation
2. Choose the appropriate version.
In most cases, you will want to use the latest version of the API operation.
VERSION=version_number
When you execute a PayPal API operation, you use credentials, such as a signature, to
authenticate that you are requesting the API operation. The following diagram shows the API
credentials part of an NVP request:
URL Encoding
All requests to execute PayPal API operations sent via HTTP must be URL encoded.
The PayPal NVP API uses the HTTP protocol to send requests and receive responses from a
PayPal API server. You must encode all data sent using the HTTP protocol because data that is
not encoded could be misinterpreted as part of the HTTP protocol instead of part of the
request. Most programming languages provide a way to encode strings in this way. You
should consistently URL encode the complete API request; otherwise, you may find that
unanticipated data causes an error.
NOTE: An HTTP form is automatically URL encoded by most browsers.
To execute a PayPal NVP API operation, submit your complete request to one of the following
end points:
NOTE: You must use different API credentials for each kind of server. Typically, you obtain
API credentials when you test in the Sandbox and then obtain another set of
credentials for the production server. You must change each API request to use the
new credentials when you go live.
All responses to PayPal API operations contain information that may be useful for debugging
purposes. You should log the Correlation ID, which identifies the API operation to PayPal,
and response-specific information, such as the transaction ID, which you can use to review a
transaction on the PayPal website or through the API. You can log other information that may
be useful, such as the timestamp. You could implement a scheme that logs the entire request
and response in a “verbose” mode; however, you should never log the password from a
request.
Field Description
ACK Acknowledgement status, which is one of the following values:
z Success indicates a successful operation
z SuccessWithWarning indicates a successful operation; however, there are
messages returned in the response that you should examine
z Failure indicates that the operation failed; the response will also contain one or
more error message explaining the failure.
z FailureWithWarning indicates that the operation failed and that there are
messages returned in the response that you should examine
CORRELATIONID Correlation ID, which uniquely identifies the transaction to PayPal
TIMESTAMP The date and time that the requested API operation was performed
VERSION The version of the API
BUILD The sub-version of the API
URL Decoding
All responses to HTTP POST operations used by the PayPal NVP API must be decoded.
The PayPal NVP API uses the HTTP protocol to send requests and receive responses from a
PayPal API server. You must decode all data returned using the HTTP protocol so that it can
be displayed properly. Most programming languages provide a way to decode strings.
NOTE: Most browsers decode responses to HTTP requests automatically.
The simplest Express Checkout integration requires the following PayPal API operations:
SetExpressCheckout, DoExpressCheckoutPayment, and optionally,
GetExpressCheckoutDetails.
z Setting Up the Express Checkout Transaction
z Obtaining Express Checkout Transaction Details
z Completing the Express Checkout Transaction
This example assumes that you have set up the mechanism you will use to communicate with
the PayPal server and have a PayPal business account with API credentials. It also assumes
that the payment action is a final sale.
When you set up an Express Checkout transaction, you specify values in the
SetExpressCheckout request and then call the API. The values you specify control the
PayPal page flow and the options available to you and your buyers. You should start by setting
up a standard Express Checkout transaction, which can be modified to include additional
options.
To set up the simplest standard Express Checkout transaction
1. Specify the amount of the transaction; include the currency if it is not in US dollars.
Specify the total amount of the transaction if it is known; otherwise, specify the subtotal.
Regardless of the specified currency, the format must have decimal point with exactly two
digits to the right and an optional thousands separator to the left, which must be a comma;
for example, EUR 2.000,00 must be specified as 2000.00 or 2,000.00. The specified
amount cannot exceed USD $10,000.00, regardless of the currency used.
AMT=amount
CURRENCYCODE=currencyID
NOTE: You can use the return URL to piggyback parameters between pages on your site.
For example, you can set your Return URL to specify additional parameters using
the https://www.yourcompany.com/page.html?param=value... syntax. The
parameters become available as request parameters on the page specified by the
Return URL.
RETURNURL=return_url
CANCELURL=cancel_url
PAYMENTACTION=Sale
PAYMENTACTION=Authorization
PAYMENTACTION=Order
https://www.sandbox.paypal.com/webscr
?cmd=_express-checkout&token=tokenValue
&AMT=amount
&CURRENCYCODE=currencyID
&RETURNURL=return_url
&CANCELURL=cancel_url
This example assumes that PayPal redirects to your buyer’s browser with a valid token after
the buyer reviews the transaction on PayPal.
Although you are not required to invoke the GetExpressCheckoutDetails API operation,
most Express Checkout implementations take this action to obtain information about the
buyer. You invoke the GetExpressCheckoutDetails API operation from the page
specified by return URL, which you set in your call to the SetExpressCheckout API.
Typically, you invoke this operation as soon as the redirect occurs and use the information in
the response to populate your review page.
To obtain a buyer’s shipping address and Payer ID
1. Specify the token returned by PayPal when it redirects the buyer’s browser to your site.
PayPal returns the token to use in the token HTTP request parameter when redirecting to
the URL you specified in your call to the SetExpressCheckout API.
TOKEN=tokenValue
This example assumes that PayPal redirects your buyer’s browser to your website with a valid
token after you call the SetExpressCheckout API. Optionally, you may call the
GetExpressCheckoutDetails API before calling the DoExpressCheckoutPayment
API.
In the simplest case, you set the total amount of the order when you call the
SetExpressCheckout API. However, you can change the amount before calling the
DoExpressCheckoutPayment API if you did not know the total amount when you called
the SetExpressCheckout API.
This example assumes the simplest case, in which the total amount was specified in the return
URL when calling the SetExpressCheckout API. Although you can specify additional
options, this example does not use any additional options.
To execute an Express Checkout transaction
1. Specify the token returned by PayPal when it redirects the buyer’s browser to your site.
PayPal returns the token to use in the token HTTP request parameter when redirecting to
the URL you specified in your call to the SetExpressCheckout API.
TOKEN=tokenValue
2. Specify the Payer ID returned by PayPal when it redirects the buyer’s browser to your site.
PayPal returns the Payer ID to use in the token HTTP request parameter when redirecting
to the URL you specified in your call to the SetExpressCheckout API. Optionally, you
can obtain the Payer ID by calling the GetExpressCheckoutDetails API.
PAYERID=id
3. Specify the amount of the order including shipping, handling, and tax; include the currency
if it is not in US dollars.
Regardless of the specified currency, the format must have decimal point with exactly two
digits to the right and an optional thousands separator to the left, which must be a comma;
for example, EUR 2.000,00 must be specified as 2000.00 or 2,000.00. The specified
amount cannot exceed USD $10,000.00, regardless of the currency used.
AMT=amount
CURRENCYCODE=currencyID
PAYMENTACTION=Sale
PAYMENTACTION=Authorization
PAYMENTACTION=Order
This example shows how to simulate your web pages using HTTP forms and supplying the
values for API operations from these forms. You can use this strategy for your initial testing;
however, for more complete testing, you will want to replace these forms with your web pages
containing actual code.
The following diagram shows the Express Checkout execution flow, which uses the Sandbox
as the API server. The pages on the left represent your site.
The following steps match the circled numbers in the diagram. Perform the actions in each
step to test Express Checkout.
1. Invoke a form on your site that calls the SetExpressCheckout API on the Sandbox.
To invoke the API, set form fields whose names match the NVP names of the fields you want
to set, specify their corresponding values, and then post the form to a PayPal Sandbox server,
such as https://api-3t.sandbox.paypal.com/nvp, as shown in the following
example:
NOTE: The API username is a Sandbox business test account for which a signature exists. See
the Test Certificates tab of the Sandbox to obtain a signature. If you are not using a
signature, you must use a different Sandbox server.
2. Review the response string from the SetExpressCheckout API operation.
PayPal responds with a message, such as the one shown below. Note the status, which
should include ACK set to Success, and a token that is used in subsequent steps.
TIMESTAMP=2007%2d04%2d05T23%3a23%3a07Z
&CORRELATIONID=63cdac0b67b50
&ACK=Success
&VERSION=52%2e000000
&BUILD=1%2e0006
&TOKEN=EC%2d1NK66318YB717835M
3. If the operation was successful, use the token and redirect your browser to the Sandbox to
log in, as follows:
https://www.sandbox.paypal.com/cgi-bin/webscr?
cmd=_express-checkout
&token=EC-1NK66318YB717835M
NOTE: The token in the command line is an HTTP request parameter and not the NVP
field; this parameter name must be lowercase.
You may need to replace hexadecimal codes with ASCII codes; for example, you may need
to replace %2d in the token with a hyphen ( - ).
You must log in to https://developer.paypal.com before you log in to a Sandbox
test account. You then log in to the test account that represents the buyer, not the
API_username business test account that represents you as the merchant.
4. After logging into the buyer test account, confirm the details.
When you confirm, the Sandbox redirects your browser to the return URL you specified
when invoking the SetExpressCheckout API operation, as in the following example:
http://www.YourReturnURL.com/
?token=EC-1NK66318YB717835M&PayerID=7AKUSARZ7SAT8
5. Invoke a form on your site that calls the GetExpressCheckoutDetails API operation
on the Sandbox:
TIMESTAMP=2007%2d04%2d05T23%3a44%3a11Z
&CORRELATIONID=6b174e9bac3b3 &ACK=Success
&VERSION=52%2e000000
&BUILD=1%2e0006
&TOKEN=EC%2d1NK66318YB717835M
&[email protected]
&PAYERID=7AKUSARZ7SAT8
&PAYERSTATUS=verified
&FIRSTNAME=...
&LASTNAME=...
&COUNTRYCODE=US
&BUSINESS=...
&SHIPTONAME=...
&SHIPTOSTREET=...
&SHIPTOCITY=...
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOCOUNTRYNAME=United%20States
&SHIPTOZIP=94666
&ADDRESSID=...
&ADDRESSSTATUS=Confirmed
6. Invoke a form on your site that invokes the DoExpressCheckoutPayment API operation
on the Sandbox:
TIMESTAMP=2007%2d04%2d05T23%3a30%3a16Z
&CORRELATIONID=333fb808bb23 &ACK=Success
&VERSION=52%2e000000
&BUILD=1%2e0006
&TOKEN=EC%2d1NK66318YB717835M
&TRANSACTIONID=043144440L487742J
&TRANSACTIONTYPE=expresscheckout
&PAYMENTTYPE=instant
&ORDERTIME=2007%2d04%2d05T23%3a30%3a14Z
&AMT=19%2e95
&CURRENCYCODE=USD
&TAXAMT=0%2e00
&PAYMENTSTATUS=Completed
&PENDINGREASON=None
&REASONCODE=None
&FEEAMT=0%2e43
You can specify options in Express Checkout API requests that change the appearance,
behavior, and flow of the checkout process.
z PayPal Review Page Order Details
z PayPal Page Style
z Changing the Locale
z Handling Shipping Addresses
z Automatically Filling Out the PayPal Login Page
z User Confirms Order on PayPal
(9) – Shipping discount. If the buyer is receiving a discount on shipping, the value appears as a
credit in this field.
(10) – Insurance. If there is insurance on shipping, the insurance fee is shown in this field.
(11) – Total. This is the total of the order, including shipping, handling, tax, and other price
adjustment-related items.
NOTE: The ‘Enter gift certificate, reward, or discount’ link enables the buyer to redeem
certificates, rewards, or discounts PayPal issues. The link does not enable the buyer to
redeem incentives that you issue.
(12) – Note. You can allow the buyer to send you special instructions about the order in a text
box that appears when the buyer clicks this link.
The following example shows how to set the above parameters in the call to
SetExpressCheckout.
Request Parameters:
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=http://...
&CANCELURL=http://...
&PAYMENTACTION=Sale
&NAME=J Smith
&SHIPTOSTREET=1 Main St
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&L_NAME0=10% Decaf Kona Blend Coffee
&L_NUMBER0=623083
&L_DESC0=Size: 8.8-oz
&L_AMT0=9.95
&L_QTY0=2
&L_NAME1=Coffee Filter bags
&L_NUMBER1=623084
&L_DESC1=Size: Two 24-piece boxes
&L_AMT1=39.70
&L_QTY1=2
&ITEMAMT=99.30
&TAXAMT=2.58
&SHIPPINGAMT=3.00
&HANDLINGAMT=2.99
&SHIPDISCAMT=-3.00
&INSURANCEAMT=1.00
&AMT=105.87
&CURRENCYCODE=USD
&ALLOWNOTE=1
Response Parameters
[successResponseFields]
&TOKEN=EC-17C76533PL706494P
You can provide values for any subset of the Express Checkout parameters shown in
SetExpressCheckout Order Details Parameters in the call to SetExpressCheckout.
If you pass the generic order description parameter (DESC) and any one line-item parameter
listed below, both parameter values display on the Review page. If you pass the generic order
description parameter (DESC) along with any two of the following line-item parameters, the
order description value does not display.
z L_NAMEn
z L_NUMBERn
z L_DESCn
If you pass in unit price information (L_AMTn) without passing in the unit quantity (L_QTYn),
the unit price will not display. To show both values, you must pass in values for both
parameters. You can pass in a value of 1 even if the item purchase is uncountable.
eBay-Issued Incentives
If the buyer’s checkout includes eBay auction items, you must set additional fields in the call
to SetExpressCheckout to enable buyers to choose from eBay-issued incentives such as
eBay gift certificates, coupons, vouchers, and gift cards that may apply to their order.
To enable the display of eBay incentives on the PayPal Review page, you also must provide
line item detail information for each eBay item. When the buyer clicks the Enter gift
certificate, reward, or discount link, a dialog displays in which the buyer can either enter a
redemption code or select from a list of all discounts applicable to eBay items in the cart
display as shown below. If multiple items display, the buyer can select from the discounts they
want applied to their order.
After entering a redemption code or selecting the incentives, the PayPal Review page reflects
changes to the order. Incentives appear as credits and a new Total is calculated as shown
below.
– For multiple eBay items offered as a single order, pass the value returned by eBay when
setting up the auction order description in the parameter below:
L_EBAYITEMORDERIDn
3. It is recommended that you pass the string “eBay item” in L_DESCn and the eBay Item
Number in L_NUMBERn.
4. If you host the final payment confirmation page on your website by setting
useraction=continue in the redirect, you must show the discount amount resulting
from eBay incentives on that page. You can get the discount amount from the
PAYPALADJUSTMENT value returned in the response to GetExpressCheckoutDetails.
NOTE: eBay maintains detailed information about each item sold in eBay auctions. If you set
the value for SHIPPINGAMT in the call to SetExpressCheckout, for example, you
do not need to be concerned about the shipping cost for individual items. eBay
calculates incentives based on its database, not from the values you pass in the
SetExpressCheckout call.
The following SetExpressCheckout request example passes order details and eBay
incentives for two eBay auction items:
Request Parameters:
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=http://coffee2go.com
&CANCELURL=http://cancel.com
&PAYMENTACTION=Sale
&[email protected]
&NAME=J Smith
&SHIPTOSTREET=1 Main St
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&L_NAME0=Photo
&L_NUMBER0=32768923
&L_DESC0=Plastic Frame- An EBay item
&L_AMT0=25.00
&L_QTY0=1
&L_EBAYITEMNUMBER0=32768923
&L_EBAYITEMAUCTIONTXNID0=0
&L_NAME1=Nokia ND
&L_NUMBER1=32768924
&L_DESC1=Nokia Mobile- An EBay item
&L_AMT1=25.00
&L_QTY1=1
&L_EBAYITEMNUMBER1=32768924
&L_EBAYITEMAUCTIONTXNID1=7225687004
&CHANNELTYPE=eBayItem
&ITEMAMT=50.00
&SHIPPINGAMT=3.00
&HANDLINGAMT=3.00
&AMT=56.00
&CURRENCYCODE=USD
&ALLOWNOTE=1
Response Parameters
[successResponseFields]
&TOKEN=EC-2HX34015EC629990M
The following example sets colors for the header background (HDRBACKCOLOR) and header
border (HDRBORDERCOLOR).
Request Parameters
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=https://...
&CANCELURL=https://...
&AMT=10.00
&MAXAMT=
&PAYMENTACTION=Sale
&HDRBACKCOLOR=FFFF66
&HDRBORDERCOLOR=996666
&SHIPTOSTREET=1 Main St
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&SHIPTOPHONENUM=408-967-4444
Response Parameters
[successResponseFields]
&TOKEN=EC-17C76533PL706494P
The figure below shows the PayPal Login page with HDRBACKCOLOR and HDRBORDERCOLOR
set to custom colors.
PayPal Login page with custom header background and border colors
Confirmed Address
A confirmed address is a shipping address that PayPal has established as belonging to the
PayPal account holder. To be protected by PayPal’s Seller Protection Policy, you must require
the shipping address be a confirmed address.
NOTE: Because many buyers prefer to ship to a non-confirmed address (they may, for
example, be shipping a gift to someone), PayPal does not recommend requiring a
confirmed address unless you are selling high-risk merchandise. If you prefer
confirmed addresses be used, then do not set ADDROVERRIDE, as described in
Shipping Address Override.
To require a confirmed address for the shipping address, ensure that the shipping address
matches the address on record with PayPal. You can do this through your account profile, as
described in the Merchant Setup and Administration Guide. The guide is available on the
Documentation page linked to the Library tab on Developer Central. Alternately, you can set a
flag in the call to SetExpressCheckout as described below:
1. Include the optional REQCONFIRMSHIPPING parameter in the call to
SetExpressCheckout.
2. Set REQCONFIRMSHIPPING to 1.
The following example requires the shipping address be a confirmed address.
NOTE: The value of REQCONFIRMSHIPPING overrides the setting in your Merchant Account
Profile.
Request Parameters
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=https://...
&CANCELURL=https://...
&AMT=10.00
&PAYMENTACTION=Sale
&REQCONFIRMSHIPPING=1
&SHIPTOSTREET=1 Main St
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&SHIPTOPHONENUM=408-967-4444
Response Parameters
[successResponseFields]
&TOKEN=EC-6UA07551EA393551U
The figure below shows the PayPal review page when REQCONFIRMSHIPPING is set to 1.
Request Parameters
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=https://...
&CANCELURL=https://...
&AMT=10.00
&CURRENCYCODE=USD
&PAYMENTACTION=Sale
&NOSHIPPING=1
&SHIPTOSTREET=1 Main St
SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&SHIPTOPHONENUM=408-967-4444
Response Parameters
[successResponseFields]
&TOKEN=EC-17C76533PL706494P
The figure below shows the PayPal review page when NOSHIPPING is set to 1.
The following example overrides the shipping address with the address values shown.
Request Parameters
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=https://...
&CANCELURL=https://...
AMT=10.00
&CURRENCYCODE=USD
&PAYMENTACTION=Sale
&ADDROVERRIDE=1
&SHIPTOSTREET=1 Second St
&SHIPTOSTREET2=Ste 210
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&SHIPTOPHONENUM=408-967-4444
Response Parameters
[successResponseFields]
&TOKEN=EC-57K68322WE343022B
The figure below shows the PayPal Review page when the shipping address parameters are
overridden by the values shown in the above example.
Request Parameters
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=https://...
&CANCELURL=https://...
&AMT=10.00
&PAYMENTACTION=Sale
&SHIPTOSTREET=1 Main Street
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&[email protected]
&SHIPTOPHONENUM=408-559-5948
Response Parameters
[successResponseFields]
&TOKEN=EC-6UA07551EA393551U
As a convenience, PayPal fills out the billing address fields with the buyer’s shipping address
as shown in the example figure below. The buyer can edit the information by clicking the
Change links.
read Pay Now. (After the buyer returns from the PayPal site, you must call
DoExpressCheckoutPayment to actually complete the transaction.)
To display Pay Now on the button:
1. Get the token from the response to SetExpressCheckout.
The response to SetExpressCheckout is the buyer’s token. For example, if the value of
RETURNURL passed to SetExpressCheckout is
https://www.websitename.com/snagECvalues, the URL to which PayPal redirects
appears as https://www.websitename.com/snagECvalues?token=EC-
0W8920957N684880R
2. Add the token and the desired useraction value (continue or commit) as name-value pairs
to the following URL:
https://www.paypal.com/cgi-bin/webscr?cmd=_express-
checkout&token=valueFromSetExpressCheckoutResponse&useraction=commit
The figure below shows the PayPal Review page when useraction=commit.
The Instant Update API is a callback you can use to obtain the buyer’s shipping address.
z About the Instant Update API
z How the Callback Works in the Express Checkout Flow
z Following Instant Update API Best Practices
z Setting Up the Callback
z Using the Callback
Integration Steps
Integrating the Instant Update API requires some preparation and modification to the Express
Checkout API calls.
To integrate the server API, follow these steps:
1. Set up a secure, fast web service to accept HTTP requests from PayPal. On the live site, it
needs to be secured by means of SSL.
2. Enable the callback service to process PayPal requests and send back responses.
3. Modify the existing Express Checkout API calls to accommodate new parameters.
– Send the callback URL, shipping, insurance, and tax information to PayPal in the call to
SetExpressCheckout.
– Call GetExpressCheckoutDetails to obtain the buyer’s final choices for shipping
and insurance, if applicable.
– Call DoExpressCheckoutPayment with the buyer’s final selections.
4. Eliminate your shipping options page.
5. Test your integration for the callback and flat rate shipping options.
You can control what options are presented to the buyer as the options can be instantly
updated on the page.
From left to right, the following events are represented. Text in boldface describes events
supporting the callback.
1. The Express Checkout flow is initiated on your shopping cart page when the buyer clicks
the Checkout with PayPal button.
2. In the call to the SetExpressCheckout API operation, you provide the URL where
PayPal can call your callback server, the flat rate shipping options, and cart line-item
details.
3. You receive a token in the response.
To start, you must build and operate a secure, reliable, and fast web service that computes the
shipping options based on the business rules. To verify that the callback request is indeed
originating from PayPal, you can check to see if the request originates from *.paypal.com as
described in the go-live checklist at this location.
In the sandbox environment, you can use both HTTP and HTTPS. PayPal will validate the
following information about the callback:
z The callback URL must start with HTTPS for production integration.
z The callback URL must start with HTTP or HTTPS for sandbox integration.
In the call to SetExpressCheckout, you must complete the steps 1 through 3 below. Steps 4
and 5 are optional:
1. Provide line-item details for the merchandise the buyer selected. For details on how to
integrate line-item details, see Chapter 7, “Customizing Express Checkout,” in the Express
Checkout Integration Guide.
2. Provide the URL to your web service for the callback. PayPal validates the URL as
described above.
3. Provide values for the flat rate shipping options. For each option, specify
– Option name (L_SHIPPINGOPTIONNAMEn)
– Option label (L_SHIPPINGOPTIONLABELn)
– Option amount (L_SHIPPINGOPTIONAMOUNTn)
– The shipping option to appear in the drop-down menu as the default (true)
(L_SHIPPINGOPTIONISDEFAULTn).
NOTE: Set L_SHIPPINGOPTIONISDEFAULTn to true (default) for one and only one
shipping option. Set L_SHIPPINGOPTIONISDEFAULTn to false for each of the
remaining options.
– If required, an adjusted value for TAXAMT
– If required, an adjusted value INSURANCEAMT
4. If necessary to adjust the callback timeout (default: 3 seconds), provide a value from 1 to 6
for the CALLBACKTIMEOUT parameter.
5. Optionally, provide values for any of the shipping option description details fields listed
below:
– Option weight (L_ITEMWEIGHTVALUEn, L_ITEMWEITHTUNITn)
– Option height (L_ITEMHEIGHTVALUEn, L_ITEMHEIGHTUNITn)
Other Considerations
When you implement the callback, there are other issues you must take into consideration.
These include:
z Callback response errors
z Maximum shipping options
z Callback times out
Callback Response Errors
If there are any callback response errors, PayPal responds by displaying the flat rate shipping
options on the PayPal Review page. To obtain the richer set of options available through the
callback, exercise care in the syntax and values you specify and test the callback integration.
Maximum Shipping Options
You can specify up to a maximum of 10 shipping options for the flat rate options in the call to
SetExpressCheckout and for the detailed options based on shipping address in the callback
response.
Callback Times Out
If the callback does not return within the timeout period, PayPal displays the flat rate shipping
options you specified in the call to SetExpressCheckout in the drop-down menu on the
PayPal Review page.
The PayPal Review page in the figure below shows two flat rate shipping options the buyer
can choose from if the callback times out. Note also that a flat rate amount of $1.00 is offered
for insurance.
To use the callback, you add parameter fields to SetExpressCheckout, provide PayPal a
URL for sending a callback request, and send PayPal the callback response in Name-Value
pair (NVP) format.
SetExpressCheckout
In the call to SetExpressCheckout, set the following parameters:
z Set the CALLBACKURL field to the URL where PayPal can call your web service. PayPal
makes the HTTPS callback request each time either of the following events occur:
– The buyer changes their shipping address
– The buyer enters a new shipping address
z Provide values for the following required parameters:
– Provide values for the line-item details parameters such as L_NAMEn, L_NUMBERn,
L_DESCn, L_AMTn, and L_QTYn shown in the example below.
– Provide values for the flat-rate shipping options: n, L_SHIPPINGOPTIONISDEFAULTn,
L_SHIPPINGOPTIONNAMEn, L_SHIPPINGOPTIONLABELn, and
L_SHIPPINGOPTIONAMOUNTn.
– Set SHIPPINGAMT to the amount set for the default flat-rate shipping option.
If, for example, L_SHIPPINGISDEFAULT1=true and
L_SHIPPINGOPTIONAMOUNT1=8.00, then SHIPPINGAMT=8.00
– Set MAXAMT to the expected maximum total amount of the complete order.
It is recommended that the maximum total amount be slightly greater than the sum of
the line-item order details, tax, and the shipping option of greatest value.
z Optionally provide values for the following parameters:
– Set INSURANCEOPTIONOFFERED to true to inform PayPal that you are offering
insurance options. Otherwise, set INSURANCEOPTIONSOFFERED to false.
– Set line-item description details such as L_ITEMWEIGHTUNIT1 and
L_ITEMWEIGHTVALUE1 shown in the example below.
– Set CALLBACKTIMEOUT to the amount of time in seconds to process the callback. By
default, CALLBACKTIMEOUT is 3. You can specify a value in the range of 1 to 6
inclusive.
This is an example SetExpressCheckout request. The above parameters appear in boldface
text.
Request Parameters:
[requiredSecurityParameters]
&METHOD=SetExpressCheckout
&RETURNURL=http://...
&CANCELURL=http://...
&PAYMENTACTION=Sale
&NAME=J Smith
&SHIPTOSTREET=1 Main St
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRYCODE=US
&SHIPTOZIP=95131
&L_NAME0=10% Decaf Kona Blend Coffee
&L_NUMBER0=623083
&L_DESC0=Size: 8.8-oz
&L_AMT0=9.95
&L_QTY0=2
&L_NAME1=Coffee Filter bags
&L_NUMBER1=6230
&L_DESC1=Size: Two 24-piece boxes
&L_AMT1=39.70
&L_QTY1=2
&L_ITEMWEIGHTVALUE1=0.5
&L_ITEMWEIGHTUNIT1=lbs
&ITEMAMT=99.30
&TAXAMT=2.59
&MAXAMT=150.00
&SHIPPINGAMT=8.00
&SHIPDISCAMT=-3.00
&AMT=107.89
&CURRENCYCODE=USD
&ALLOWNOTE=1
&CALLBACK=https://...
&CALLBACKTIMEOUT=4
&INSURANCEOPTIONOFFERED=true
&INSURANCEAMT=1.00
&L_SHIPPINGOPTIONISDEFAULT0=false
&L_SHIPPINGOPTIONNAME0=Ground
&L_SHIPPINGOPTIONLABEL0=UPS Ground 7 Days
&L_SHIPPINGOPTIONAMOUNT0=3.50
&L_SHIPPINGOPTIONISDEFAULT1=true
&L_SHIPPINGOPTIONNAME1=UPS Air
&L_SHIPPINGOPTIONlABEL1=UPS Next Day Air Freight
&L_SHIPPINGOPTIONAMOUNT1=8.00
Response Parameters
[successResponseFields]
&TOKEN=EC-17C76533PL706494P
Callback Request
The PayPal sends the parameters in the callback request to the location you specified for
CALLBACKURL. The callback request parameters include:
z The line-item details you sent in the call to SetExpressCheckout. PayPal also sends
back any line-item description details you may have specified such as the
L_ITEMWEIGHTUNIT1 and L_ITEMWEIGHTVALUE1 values shown in the example below.
By passing this data back to you, PayPal expedites your callback response by eliminating
the need for you to perform a database query to get this information.
z The shipping address of the buyer.
Using the information in the callback request, you can calculate the rates and options yourself
or send the information in an API call to your carrier to perform the calculations for you.
This is an example callback request.
METHOD=CallbackRequest
&CALLBACKVERSION=57.0
&TOKEN=EC-0EE85728D547104V
&CURRENCYCODE=USD
&LOCALECODE=en_US
&L_NAME0=10% Decaf Kona Blend Coffee
&L_NUMBER0=623083
&L_DESC0=Size: 8.8-oz
&L_AMT0=9.95
&L_QTY0=2
&L_NAME1=Coffee Filter bags
&L_NUMBER1=6230
&L_DESC1=Size: Two 24-piece boxes
&L_AMT1=39.70
&L_QTY1=2
&L_ITEMWEIGHTUNIT1=lbs
&L_ITEMWEIGHTVALUE1=0.5
&SHIPTOSTREET=1 Main St
&SHIPTOCITY=San Jose
&SHIPTOSTATE=CA
&SHIPTOCOUNTRY=US
&SHIPTOZIP=95131
&SHIPTOSTREET2
Callback Response
Each time your web service receives a request from PayPal, it must process the request and
respond with the appropriate details.
This is an example callback response.
METHOD=CallbackResponse
&OFFERINSURANCEOPTION=true
&L_SHIPPINGOPTIONNAME0=UPS Air
&L_SHIPPINGOPTIONLABEL0=UPS Next Day Air Freight
&L_SHIPPINGOPTIONAMOUNT0=20.00
&L_TAXAMT0=2.20
&L_INSURANCEAMOUNT0=1.51
&L_SHIPPINGOPTIONISDEFAULT0=false
&L_SHIPPINGOPTIONNAME1=UPS Expedited
&L_SHIPPINGOPTIONLABEL1=UPS Express 2 Days
&L_SHIPPINGOPTIONAMOUNT1=10.00
&L_TAXAMT1=2.00
&L_INSURANCEAMOUNT1=1.35
&L_SHIPPINGOPTIONISDEFAULT1=true
&L_SHIPPINGOPTIONNAME2=UPS Ground
&L_SHIPPINGOPTIONLABEL2=UPS Ground 2 to 7 Days
&L_SHIPPINGOPTIONAMOUNT2=9.99
&L_TAXAMT2=1.99
&L_INSURANCEAMOUNT2=1.28
&L_SHIPPINGOPTIONISDEFAULT2=false
Immediate Payment ensures buyer payment for an item you are selling on eBay at the time the
buyer commits to the item, to avoid unpaid items that drive up the operational cost of your
business. You integrate Immediate Payment as additional Express Checkout parameters and
use your own off-eBay checkout flow.
z “Overview of Immediate Payment” on page 81
z “Integrating Immediate Payment into the Express Checkout Flow” on page 83
NOTE: Immediate Payment is available with API version 60.0 and later.
From left to right, the following events are represented. The numbered callouts in the figure
directly correspond to the numbered comments below:
1. The eBay flow for third-party checkout redirects the buyer from an eBay payment review
page to your shopping cart page. On your shopping cart page, the buyer initiates Express
Checkout by clicking the Checkout with PayPal button.
2. In the call to the SetExpressCheckout API operation, you must pass the following
Immediate Payment information:
– ALLOWEDPAYMENTMETHOD: This is the payment method type. For immediate payment,
the value is InstantPaymentOnly.
– BUYERUSERNAME: EBay provides you with this value.
– L_EBAYITEMCARTIDn: EBay provides you with this value.
Additionally, in the call to the SetExpressCheckout API operation, you must pass the
following Express Checkout API parameter data:
– CHANNELTYPE: The value of the channel type, which is eBayItem .
– L_EBAYITEMNUMBERn: This is the eBay item number.
cart of eBay and non-eBay items.To allow the buyer to check out just the non-Immediate
Payment items, you must provide an appropriate message to the buyer, remove the Immediate
Payment item, and retry the transaction.
You can use PayPal API operations to handle the capture of payments authorized using
Express Checkout and manage Express Checkout authorization and order payment actions.
z Sale Payment Action
z Authorization Payment Action
z Order Payment Action
PAYMENTACTION=Sale
A sale is the most straightforward payment action. Choose this payment action if the
transaction, including shipping of goods, can be completed immediately. To use this payment
action:
z The final amount of the payment must be known when you invoke the
DoExpressCheckoutPayment API operation
z You should intend to fulfill the order immediately, such as would be the case for digital
goods or for items you have in stock for immediate shipment
After you execute the DoExpressCheckoutPayment API operation, the payment is
complete and further action is unnecessary. You cannot capture a further payment or void any
part of the payment when you use this payment action.
PAYMENTACTION=Authorization
An authorization enables you to capture multiple payments up to 115% of, or USD $75 more
than, the amount you specify in the DoExpressCheckoutPayment request. Choose this
payment action if you need to ship the goods before capturing the payment or if there is some
reason not to accept the payment immediately.
The honor period, for which funds can be held, is three days. The valid period, for which the
authorization is valid, is 29 days. You can reauthorize the 3-day honor period at most once
within the 29-day valid period.
You can void an authorization, in which case, the uncaptured part of the amount specified in
the DoExpressCheckoutPayment request becomes void and can no longer be captured. If
no part of the payment has been captured, the entire payment becomes void and nothing can be
captured.
API operations associated with authorization payment actions
API Operation Description
DoCapture Capture an authorized payment
DoReauthorization Reauthorize a payment
DoVoid Void an order or an authorization
PAYMENTACTION=Order
An order enables you to create multiple authorizations over the 29 days; each authorization
you create places the buyer’s funds on hold for up to three days. You can capture multiple
payments for each authorization, up to 115% of, or USD $75 more than, the amount you
specify in the DoExpressCheckoutPayment request.
NOTE: The default number of child authorizations in your PayPal account is 1. To do
multiple authorizations please contact PayPal to request an increase.
This payment action provides the most flexibility and should be used when either a sale or one
authorization plus one reauthorization do not meet your needs. Situations in which orders are
appropriate include the handling of
z Back orders, in which available merchandise is sent immediately and the remaining
merchandise is sent when available, which may include more than two shipments
z Split orders, in which merchandise is sent in more than one shipment, perhaps to different
addresses, and you want to collect a payment for each shipment
z Drop shipments, which are shipments from other vendors for which you accept the
payment
You cannot reauthorize an authorization. You handle the need to reauthorize, for example
when the hold period or valid period of an authorization expires, simply by creating another
authorization.
You can void an order or an authorization created from the order. If you void an order, the
uncaptured part of the amount specified in the DoExpressCheckoutPayment request
becomes void and can no longer be captured. If no part of the payment has been captured, the
entire payment becomes void and nothing can be captured.
If you void an authorization associated with the order, the uncaptured part of the amount
specified in the authorization becomes void and can no longer be captured. If no part of the
authorization has been captured, the entire authorized payment becomes void.
API operations associated with order payment actions
API Operation Description
DoAuthorization Authorize a payment
DoCapture Capture an authorized payment
DoVoid Void an order or an authorization
Set up a recurring payment to handle subscription and other payments that occur on a fixed
schedule.
z Recurring Payments Demo
z How Recurring Payments Work
z Recurring Payments Terms
z Recurring Payments With Express Checkout
z Options for Creating a Recurring Payments Profile
z Recurring Payments Profile Status
z Getting Recurring Payments Profile Information
z Modifying a Recurring Payments Profile
z Billing the Outstanding Amount of a Profile
z Recurring Payments Notifications
Limitations
The current release of the Recurring Payments API has the following limitations:
z A profile can have at most one optional trial period and a single regular payment period.
z The profile start date may not be earlier than the profile creation date.
Recurring payments with Express Checkout also has the following limitations:
z At most ten recurring payments profiles can be created during checkout.
z You can only increase the profile amount by 20% in each 180-day interval after the profile
is created.
z Initiating the processing flow to create one or more billing agreements for recurring
payments with no associated one-time purchase or recurring payment
NOTE: You can also initiate the processing flow using SetCustomerBillingAgreement
for orders that contain only a single recurring payment.
Typically, you set the amount of the payment for an Express Checkout transaction when you
call the SetExpressCheckout request and confirm the amount in the
DoExpressCheckoutPayment request. If, however, you set the amount of the payment to 0
in the SetExpressCheckout request, you can create a billing agreement without initiating a
payment. Regardless of whether a payment is included, you must call
DoExpressCheckoutPayment to complete the transaction.
NOTE: To create a billing agreement without purchase, use Version 54.0 or higher, of the
PayPal API.
To set up one or more billing agreements for recurring payments, modify the
SetExpressCheckout request as follows:
1. Add an L_BILLINGTYPEn field for each billing agreement you want to create; n is a value
in the range of 0 to 9, inclusive. Set the value of each field to RecurringPayments.
L_BILLINGTYPE0=RecurringPayments
2. Add an L_BILLINGAGREEMENTDESCRIPTIONn field to correspond to each
L_BILLINGTYPEn field you pass; n is a value in the range of 0 to 9, inclusive. Set the
value of each field to the description of the goods or services associated with that billing
agreement, for example:
L_BILLINGAGREEMENTDESCRIPTION0=Time Magazine subscription
3. If there is no associated purchase, set AMT to 0.
AMT=0
NOTE: When you create the recurring payments profile, you must include the same
L_BILLINGTYPEn and L_BILLINGAGREEMENTDESCRIPTIONn values in the
CreateRecurringPaymentsProfile request.
The SetExpressCheckout response provides a token that uniquely identifies the transaction
for subsequent redirects and API calls.
https://www.paypal.com/cgi-bin/webscr?cmd=_express_checkout&
token=<value_from_SetExpressCheckoutResponse>
For redirecting the buyer’s browser to the PayPal login page, PayPal recommends that you use
the HTTPS response 302 “Object Moved” with the URL above as the value of the Location
header in the HTTPS response. Ensure that you use an SSL-enabled server to prevent browser
warnings about a mix of secure and insecure graphics.
IMPORTANT: The recurring payments profile is not created until you receive a success
response from the CreateRecurringPaymentsProfile call.
The CreateRecurringPaymentsProfile response contains a Profile ID, which is an
encoded string that uniquely identifies the recurring payments profile.
By default, PayPal will not activate the profile if the initial payment amount fails. You can
override this default behavior by setting the FAILEDINITAMTACTION field to
ContinueOnFailure, which indicates that if the initial payment amount fails, PayPal should
add the failed payment amount to the outstanding balance due on this recurring payment
profile.
If this field is not set or is set to CancelOnFailure, PayPal will create the recurring payment
profile, but will place it into a pending status until the initial payment is completed. If the
initial payment clears, PayPal will notify you by IPN that the pending profile has been
activated. If the payment fails, PayPal will notify you by IPN that the pending profile has been
canceled.
The buyer will receive an email stating that the initial payment cleared or that the pending
profile has been canceled if the profile was created using Express Checkout.
NOTE: You can also get information about recurring payments profiles from the PayPal
website.
Along with the information that you specified in the CreateRecurringPaymentsProfile
request, GetRecurringPaymentsProfileDetails also returns the following summary
information about the profile:
z Profile status
z Next scheduled billing date
z Number of billing cycles completed in the active subscription period
z Number of billing cycles remaining in the active subscription period
z Current outstanding balance
z Total number of failed billing cycles
z Date of the last successful payment received
z Amount of the last successful payment received
The profile changes take effect with the next payment after the call to update the profile. Say,
for example, the buyer has made one trial payment out of a total of three.
UpdateRecurringPaymentsProfile is called to increase the number of billing cycles to
five. As a result, the buyer will have four additional trial payments to make. If the call to
UpdateRecurringPaymentsProfile is made during the regular payment period, the
changes take effect with the buyer’s next scheduled regular payment.
For complete details, see the Name-Value Pair Developer Guide and Reference or the SOAP
API Reference.
Updating Addresses
When you update the subscriber shipping address, you must enter all of address fields, not just
those that are changing:
For example, if you want to update the subscriber’s street address, you must specify all of the
address fields listed in the Name-Value Pair Developer Guide and Reference or SOAP API
Reference, not just the field for the street address.
You can use additional PayPal API operations to implement additional features for your
buyers or to provide “back office” support.
z Issuing Refunds
z Handling Payment Review
Issuing Refunds
You can use the RefundTransaction PayPal API operation to issue refunds.
Use the RefundTransaction API to issue one or more refunds associated with a
transaction, such as a transaction created by a capture of a payment. The transaction is
identified by a transaction ID that PayPal assigns when the payment is captured.
NOTE: You cannot make a refund if the transaction occured more than 60 days ago.
You can refund amounts up to the total amount of the original transaction. If you specify a a
full refund, the entire amount is refunded. If you specify a partial refund, you must specify the
amount to refund, the currency, and a description of the refund, which is called a memo.
When you call the RefundTransaction API, PayPal responds with another transaction ID,
which is associated with the refund (not the original transaction), and additional information
about the refund. This information identifies
z the gross amount of the refund, which is returned to the payer
z the amount of the refund associated with the original transaction fee, which is returned to
you
z the net amount of the refund, which is deducted from your balance
To issue a refund
1. In the RefundTransaction request, specify the transaction ID of the transaction whose
payment you want to refund .
TRANSACTIONID=transaction_id
REFUNDTYPE=Full
or
REFUNDTYPE=Partial
3. For a partial refund, specify the refund amount, including the currency.
AMT=amount
CURRENCYCODE=currencyID
NOTE=description
NOTE: You must use version 58.0 to obtain the initial status information provided by
DoExpressCheckoutPayment, DoReferenceTransaction,
DoAuthorization, or DoReauthorization.
To use payment review with the DoExpressCheckoutPayment,
DoReferenceTransaction, DoAuthorization, and DoReauthorization PayPal API
operations, you must
1. Check the payment status in the response to the API operation; specifically, check whether
PaymentStatus is set to Pending.
2. If the PaymentStatus is set to Pending, check whether the PendingReason is set to
PaymentReview, because there are other reasons that a transaction may become pending.
For example, an unsettled authorization’s PaymentStatus is set to Pending; however,
its PendingReason is set to authorization, which is not related to payment review.
If PaymentStatus is set to Pending and the PendingReason is set to PaymentReview,
you should not ship merchandise or, in the case of electronic media, you should not allow
download access.
Because the payment status will change after review, you must periodically check the payment
status using the GetTransactionDetails API operation.
The following diagram shows how to use the payment status to detect payments under review
by PayPal.
IMPORTANT: For best results, call the GetTransactionDetails API operation every six
hours; never call it more frequently than once per hour.
You must modify your Express Checkout implementation to use giropay, a common German
funding source.
z giropay Page Flows
z giropay Integration
giropay Integration
If you offer the giropay payment option, you must take additional steps to integrate with the
Express Checkout flow.