Notice of non-liability:
PayPal, Inc. is providing the information i n this document t o you “AS-IS” with all faults. PayPal, Inc. makes no warranties of any kind (whether express,
implied or statutory) with respect to the information co ntained 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 f rom 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.
Setting Up Web Pages to Invoke the Embedded Payment Flow Using a Lightbox . . . 55
Setting Up Web Pages to Invoke the Embedded Payment Flow Using a Minibrowser . 57
Adaptive Payments is intended for developers implementing payment solutions with PayPal’s
Adaptive Payments API. Check out what’s new in the current release.
1.8.1 Features
Version 1.8.1 of the Adaptive Payments API adds a new new fields related to tax ID details for
Brazil (shown below). Also a new BANK_MANAGED_WITHDRAWAL value has been
added to the paymentType field.
NOTE: Changes to API operations are backward-compatible.
SenderIdentifier Fields
FieldDescription
useCredentialsxs:boolean
If true, credentials identify the sender; default is false.
taxIdDetailsap:TaxIdDetails
T ax ID details (For Brazil only)
TaxIdDetails Fields
FieldDescription
taxIdxs:string
Tax ID of the Merchant (For Brazil only)
taxIdTypexs:string
Type of the Tax ID. Either CPF or CNPJ (For Brazil only)
Adaptive Payments Developer GuideAugust 7, 201215
1.8.1 Features
16August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
1
The Adaptive Payments API enables you to send money in many different scenarios, from
simple to complex. For example, you might build a small send money application for a social
networking site or a robust payroll system.
Adaptive Payments Actors and Objects
Adaptive payments handles payments between a sender of a payment and one or more
receivers of the payment. You are an application owner, such as a merchant that owns a
website, the owner of a widget on a social networking site, the provider of a payment
application on mobile phones, and so on. Your application is the caller of Adaptive Payments
API operations.
NOTE:The application owner must have a PayPal Business account. Senders and
receivers can have any PayPal account type. Senders and receivers are not
required to have PayPal accounts initially. PayPal prompts a sender to create
an account before a payment can be completed. A receiver must create an
account to receive the funds after the payment completes.
With many applications, you may be both the application owner and a receiver. For example,
as the owner of a website, you are the receiver of payments from the senders who are your
customers. The following diagram shows the relationship between a sender, you as a receiver,
and PayPal:
Adaptive Payments Developer GuideAugust 7, 201217
Introducing Adaptive Payments
Adaptive Payments Actors and Objects
You are not required to be a receiver. For example, if you own a shopping cart, you are not
required to receive payments directly. You can facilitate payments between the sender and
receivers that provide the actual goods. The following diagram shows the relationship between
a sender, you as an application owner that directs payments to receivers, and PayPal:
This diagram shows a payment in which the sender pays multiple receivers in a parallel
payment. With parallel payments, the sender can see the transaction to each receiver.
The following diagram shows the relationship between a sender, you as an application owner
that directs payments to receivers, and PayPal in a chained payment:
In a chained payment, the sender pays the primary receiver an amount, from which the
primary receiver pays secondary receivers. The sender only knows about the primary receiver ,
not the secondary receivers. The secondary receivers only know about the primary receiver,
not the sender.
The following diagram shows the relationship between you as both the sender and the
application owner that directs payments to receivers:
18August 7, 2012Adaptive Payments Developer Guide
For example, you might use this configuration in a sales commission application that transfers
funds owed for commissions from your account to the accounts of your sales force.
Simple, Parallel, and Chained Payments
Introducing Adaptive Payments
Simple, Parallel, and Chained Payments
Adaptive Payments provides several kinds of payment: simple, parallel, and chained
payments. You create each kind of payment with the Pay API.
Simple payments enable a sender to send a single payment to a single receiver.
For example, your website can use an Adaptive Payments payment flow to transfer money
resulting from a sale from your customer’s PayPal account to your own account. This is the
traditional kind of payment.
Parallel payments enable a sender to send a single payment to multiple receivers.
For example, your application might be a shopping cart that enables a buyer to pay for
items from several merchants with one payment. Your shopping cart allocates the payment
to merchants that actually provided the items. PayPal then deducts money from the
sender’s account and deposits it in the receivers’ accounts.
Chained payments enable a sender to send a single payment to a primary receiver. The
primary receiver keeps part of the payment and pays secondary receivers the remainder.
For example, your application could be an online travel agency that handles bookings for
airfare, hotel reservations, and car rentals. The sender sees only you as the primary
receiver. You allocate the payment for your commission and the actual cost of services
provided by other receivers. PayPal then deducts money from the sender’s account and
deposits it in both your account and the secondary receivers’ accounts.
NOTE: Chained payments also include delayed chained payments, in which payments to
secondary receivers can be delayed for up to 90 days.
Adaptive Payments Developer GuideAugust 7, 201219
Introducing Adaptive Payments
Simple, Parallel, and Chained Payments
Simple Payments
Simple payments enable a sender to send a single payment to a single receiver. This is
sometimes considered a traditional payment, such as a payment from a buyer to a seller.
Scenarios involving simple payments might include the following scenarios:
Buyer makes a payment on a merchant’s website.
Buyer makes a single payment for a cart of items from the same merchant.
Person on a social networking site makes a payment for a purchase to the receiver. For
example, a sender sends money to pay for lunch at a restaurant.
In these cases, the sender sends a payment to a single receiver. The following example shows a
sender making a simple payment:
Parallel Payments
A parallel payment is a payment from a sender that is split directly among 2-6 receivers.
Technically, a parallel payment is a set of multiple payments made in a single Pay request.
Parallel payments are useful in cases when a buyer intends to make a single payment for items
from multiple sellers. Examples include the following scenarios:
a single payment for multiple items from different merchants, such as a combination of
items in your inventory and items that partners drop ship for you.
purchases of items related to an event, such as a trip that requires airfare, car rental, and a
hotel booking.
In these cases, the sender knows the receivers and the amount paid to each one. The following
example shows a sender paying 3 receivers in a single parallel payment:
20August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Simple, Parallel, and Chained Payments
NOTE: This scenario is an example only and does not take PayPal fees into account.
Chained Payments
A chained payment is a payment from a sender that is indirectly split among multiple
receivers. It is an extension of a typical payment from a sender to a receiver, in which a
receiver, known as the primary receiver, passes part of the payment to other receivers, who are
called secondary receivers.
NOTE: The API caller must get permission from PayPal to use chained payments.
You can have at most one primary receiver and 1-5 secondary receivers. Chained payments are
useful in cases when the primary receiver acts as an agent for other receivers. The sender deals
only with the primary receiver and does not know about the secondary receivers, including
how a payment is split among receivers. The following example shows a sender making a
payment of $100:
Adaptive Payments Developer GuideAugust 7, 201221
Introducing Adaptive Payments
Payment Approval
In this example, the primary receiver receives $100 from the sender ’s perspective. The
primary receiver actually receives only $10 and passes a total of $90 to secondary receivers,
Receiver 2 and Receiver 3.
NOTE: This scenario is an example only and does not take PayPal fees into account.
Delayed Chained Payments
By default, payments to all receivers in a chained payment are immediate. However, you can
choose to delay a payment to a secondary receiver. For example, as primary receiver, you may
require secondary receivers to perform some action, such as shipping goods or waiting for
expiration of a return period, before making payment. To complete the payment, you must
explicitly execute a payment to secondary receivers after the sender pays you. The payment
must occur within 90 days, after which you cannot complete the payment as part of the
original chained payment.
Payment Approval
The sender of a payment must approve the transfer. The sender can log in to paypal.com to
approve each payment, preapprove payments, or when the sender is your application, be
implicitly approved to make payments.
NOTE: Preapproval requests require permission from PayPal.
There are 3 kinds of payment approvals:
Explicit approval payments, in which the sender logs in to paypal.com to approve each
payment.
Explicitly approving payments is the traditional way to pay with PayPal. This method is the
only option unless the sender has set up a preapproval agreement or you, the API caller, are
also the sender.
22August 7, 2012Adaptive Payments Developer Guide
Adaptive Payments Service Permissions
Preapproved payments, in which a sender logs in to PayPal and sets up preapprovals that
approve future payments or set up a preapproval during the embedded payment flow.
The sender logs in to paypal.com once to set up the preapproval. After the sender agrees to
the preapproval, specific approval is unnecessary.
Implicit approval payments, in which your application is both the sender of a payment and
the caller of the Adaptive Payments Pay API.
In this case, PayPal makes the payment from your own account, which eliminates the need
for approval.
Adaptive Payments Service Permissions
Adaptive Payments services are divided into 2 categories: standard services that do not require
specific permission to use and advanced services that require permission from PayPal to use.
You obtain permission to use a service when you submit an application to PayPal.
You can use the following standard services without requesting specific permission:
Introducing Adaptive Payments
Making simple or parallel payments that require explicit approval of the sender
Getting payment details
Making refunds
Performing currency conversions
To use any other service, you must receive permission from PayPal to use the service when
you submit your application. For example, if your application makes chained payments, whi ch
is an advanced service, you request permission when you submit your application. Later, if
you modify your application to support preapprovals, which is also an advanced service, you
must resubmit your application to obtain permission from PayPal to use the service.
IMPORTANT:If you allow a third party to PayPal to execute an application on your behalf,
the third party becomes the API caller because the party is now calling the
Adaptive Payments API. The third party must also have permission from
PayPal to use the advanced service. For example, if an application supports
chained payments, both you and the third party must have permission to use
the service.
Explicit Approval Payment Flow
Explicit approval payments require the sender to log in to paypal.com to approve the payment.
You control the interaction between your application and PayPal by specifying URLs for
redirection in various situations.
Adaptive Payments Developer GuideAugust 7, 201223
Introducing Adaptive Payments
Explicit Approval Payment Flow
The following diagram shows the basic flow of control for a payment (such as payment for
items in a shopping cart at a web store) that requires the sender to log in to paypal.com to
approve the payment:
The following items correspond to the circled numbers in the diagram:
1. Your site or device sends a Pay request to PayPal on behalf of a sender.
2. PayPal responds with a key that you use when you direct the sender to PayPal.
3. You redirect your sender’s browser to paypal.com.
4. After the sender authorizes the transfer of funds, PayPal redirects your sender’s browser to
the location you specify.
NOTE: The cancel operation is not shown in the diagram. Cancellation is handled by a
separate cancellation URL to which PayPal redirects the sender’s browser any time
the sender cancels while on paypal.com.
In addition to these steps, PayPal notifies you and the sender of the payment.
24August 7, 2012Adaptive Payments Developer Guide
Preapproved Payments Flow
Preapproved payments require the sender to log in to paypal.com to set up the payment
agreement with a particular vendor. You control the interaction between your application and
PayPal by specifying URLs for redirection in various situations.
The sender logs in to paypal.com and sets up the preapproval, which includes setting the
following information:
duration of the preapproval, from the start date to the end date, inclusive
the maximum amount being preapproved
the maximum number of payments
The following diagram shows the basic flow of control during a preapproval operation:
Introducing Adaptive Payments
Preapproved Payments Flow
The following items correspond to the circled numbers in the diagram:
1. Your site or device sends a Preapproval request to PayPal on behalf of a sender.
Adaptive Payments Developer GuideAugust 7, 201225
Introducing Adaptive Payments
Preapproved Payments Flow
2. PayPal responds with a key, called a preapproval key, that you use when you direct the
sender to PayPal, and once the preapproval has been established, whenever you
automatically complete a payment on behalf of the sender.
3. You redirect your sender’s browser to PayPal.
4. After the sender logs in to paypal.com and sets up the preapproval, PayPal redirects the
sender’s browser to a location you specify.
NOTE: The cancel operation is not shown in the above diagram. Cancellation is handled by a
separate cancellation URL to which PayPal redirects the sender’s browser any time
the sender cancels while on paypal.com.
In addition to the steps shown above, PayPal sends an email notifying you and the sender that
the preapproval has been created.
After the sender sets up the approval, you can make payments on the sender’s behalf directly.
The sender is no longer required to log in to PayPal to complete the payment. The following
diagram shows the basic flow of control during a Pay operation:
The following items correspond to the circled numbers in the diagram:
1. Your site or device sends a Pay request to PayPal on behalf of a sender. You can require the
sender to provide a personal identification number (PIN); however, logging in to
paypal.com is no longer required.
NOTE: You must provide a preapproval key that identifies the agreement.
2. PayPal still responds with a payment key that you can use for other API operations, such as
for obtaining details of the payment or for issuing a refund.
26August 7, 2012Adaptive Payments Developer Guide
Implicit Approval Payments Flow
Implicit approval payments are payments where the sender and the API caller are using the
same account. Because PayPal draws the funds for the payment from your own account, there
is no approval necessary, and as such there is no visible flow for implicit approval payments.
The following diagram shows the basic flow of control during an implicitly approved payment
operation:
Introducing Adaptive Payments
Implicit Approval Payments Flow
The following items correspond to the circled numbers in the diagram:
1. Your site or device sends a Pay request to PayPal.
NOTE: A web flow is not required.
2. PayPal responds with a key that you use for other API operations.
Embedded Payments
An embedded payment is a payment that initiates a visual presentation of the Adaptive
Payments payment flow in which the sender appears to never leave your checkout or payment
page. Embedded payments make it easier for a sender to make a payment because PayPal may
allow the sender to bypass the PayPal login step.
The ability to bypass the login relies on a remember me cookie, which is stored in the sender’s
browser when the sender chooses to take advantage of being remembered. Opting in reduces
the number of steps to purchase goods or services without significantly increasing the risk that
the sender’s account might be misused. After the initial login, PayPal bypasses the login step if
subsequent payments meet specific criteria, such as a subsequent payment for a small amount.
Adaptive Payments Developer GuideAugust 7, 201227
Introducing Adaptive Payments
Embedded Payments
Embedded Payment Flow Presentations
PayPal provides the following kinds of visual presentations for the embedded payment flow:
The payment flow can be embedded as a lightbox on your web page, which gives the
impression that the payment is handled completely within your website:
The payment flow can appear in a minibrowser window that appears in front of your web
page, which does not require an IFRAME:
28August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
The payment flow can be embedded as a lightbox in an IFRAME on your web page, which
gives the impression that the payment is handled completely within your website:
Adaptive Payments Developer GuideAugust 7, 201229
Introducing Adaptive Payments
Embedded Payments
You choose your preferred visual presentation when you invoke the embedded payment flow.
In some cases, PayPal may override your choice to use a lightbox; for example, when the
sender is required to log into PayPal for the initial payment.
You can also enable preapprovals for future payments or enable shipping addresses to be
associated with embedded payments.
30August 7, 2012Adaptive Payments Developer Guide
IMPORTANT:Payments for digital goods must use the embedded payment flow. Y ou cannot
associate a preapproval for future payments or enable shipping addresses in a
payment for digital goods.
Embedded Payments Implementation Basics
To implement the embedded payment flow, you must
include JavaScript code from PayPal on your checkout or payment web pages
use the functions provided in the JavaScript to coordinate the PayPal flow with the
appearance of your web pages
launch your preferred embedded payment flow, which is either the lightbox or
minibrowser, and redirect the sender’ s browser to the PayPal URL that supports embedded
payments, which is
You must call the Pay API operation to obtain a payment key before launching the embedded
payment flow . If the payment is specifically for digital goods, modify your Pay API operation
to specify that each receiver is receiving payment for digital goods.
Introducing Adaptive Payments
Embedded Payments
Embedded Payment Experience
To the sender of a payment, the embedded payment experience appears to be built into your
website. The PayPal-supplied JavaScript provides all the code needed to set up the flow as an
IFRAME within the sender’s browser and as a pop-up mini-browser that appears in front of
your website.
Typically, the sender initiates a payment by clicking a button:
PayPal responds to the JavaScript that initiates the flow. If it is the first payment, or if PayPal
determines that the payment requires the sender to log in, PayPal displays a Log In button in
the IFRAME created by the JavaScript:
Adaptive Payments Developer GuideAugust 7, 201231
Introducing Adaptive Payments
Embedded Payments
The IFRAME also allows the sender to sign up for a PayPal account or pay as a guest without
logging in.
NOTE: Guest checkout only provides the visual benefits of an embedded payment. It does not
reduce the payment steps.
After clicking Log In, PayPal displays a Log in to your PayPal account page in the
minibrowser. The sender enters an email address and password and can also check a box,
which allows the sender to skip this step for subsequent purchases:
32August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
The checkbox controls the remember me behavior for log in. This behavior allows the sender
to skip the log in step in cases where there is little risk of the account being misused.
IMPORTANT:Opting in to the remember me behavior does not guarantee that the sender will
not be asked to provide log in credentials.
After logging in, PayPal displays the You are about to pay page, sometimes called the review your payment page in the minibrowser:
Adaptive Payments Developer GuideAugust 7, 201233
Introducing Adaptive Payments
Embedded Payments
If the sender chooses Cancel, PayPal redirects the sender’s browser to the cancel URL
specified in the Pay API operation’s request message. If the sender chooses Pay, the Thank you for using PayPal page appears in the minibrowser:
34August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
When the sender clicks Close, PayPal redirects the sender’s browser to the return URL
specified in the Pay API operation’s request message.
NOTE: You are responsible for closing the minibrowser after PayPal redirects to the page
specified in either the return or cancel URL. PayPal provides a JavaScript function
that you call to close a PayPal minibrowser or lightbox.
For subsequent payments in which PayPal does not require the account holder to log in again
and the account holder has chosen to be remembered, the PayPal payment pages appear in a
lightbox rather than in a minibrowser and PayPal bypasses the log in steps. For these
payments, the actions you take to launch the flow and close the lightbox, remain the same.
For example, the lightbox for reviewing a payment would appear in your page as follows:
Adaptive Payments Developer GuideAugust 7, 201235
Introducing Adaptive Payments
Embedded Payments
The lightbox containing the confirmation would appear in your page as follows:
36August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
Preapprove Future Payments Checkbox
You can add a Preapprove future payments checkbox to the sender’s embedded payment
experience, which enables the sender to preapprove subsequent payments. If you specify both
a payment key and a preapproval key when you call the Pay API operation, PayPal displays
the checkbox on the payment page in the minibrowser:
Adaptive Payments Developer GuideAugust 7, 201237
Introducing Adaptive Payments
Embedded Payments
If the payment sender checks the preapproval box, the confirmation page provides details
about the preapproval:
38August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
NOTE: Unless there is an error with the payment itself, PayPal transfers the money regardless
of whether the preapproval for future payments was successful.
Shipping Address Information
You can display and collect shipping address information. PayPal displays the default shipping
address when you set senderOptions.requireShippingAddressSelection to true
in your request to SetPaymentOptions:
Adaptive Payments Developer GuideAugust 7, 201239
Introducing Adaptive Payments
Embedded Payments
The sender of a payment can select one of the available shipping addresses or add a new
shipping address by selecting Add new shipping address from the Ship to: drop-down menu:
Embedded Payment Experience
To the sender of a payment, the embedded payment experience appears to be built into your
website. The PayPal-supplied JavaScript provides all the code needed to set up the flow as an
40August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
IFRAME within the sender’s browser and as a pop-up mini-browser that appears in front of
your website.
Typically, the sender initiates a payment by clicking a button:
PayPal responds to the JavaScript that initiates the flow. If it is the first payment, or if PayPal
determines that the payment requires the sender to log in, PayPal displays a Log In button in
the IFRAME created by the JavaScript:
The IFRAME also allows the sender to sign up for a PayPal account or pay as a guest without
logging in.
NOTE: Guest checkout only provides the visual benefits of an embedded payment. It does not
reduce the payment steps.
After clicking Log In, PayPal displays a Log in to your PayPal account page in the
minibrowser. The sender enters an email address and password and can also check a box,
which allows the sender to skip this step for subsequent purchases:
Adaptive Payments Developer GuideAugust 7, 201241
Introducing Adaptive Payments
Embedded Payments
The checkbox controls the remember me behavior for log in. This behavior allows the sender
to skip the log in step in cases where there is little risk of the account being misused.
IMPORTANT:Opting in to the remember me behavior does not guarantee that the sender
will not be asked to provide log in credentials.
After logging in, PayPal displays the You are about to pay page, sometimes called the review your payment page in the minibrowser:
42August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
If the sender chooses Cancel, PayPal redirects the sender’s browser to the cancel URL
specified in the Pay API operation’s request message. If the sender chooses Pay, the Thank you for using PayPal page appears in the minibrowser:
Adaptive Payments Developer GuideAugust 7, 201243
Introducing Adaptive Payments
Embedded Payments
When the sender clicks Close, PayPal redirects the sender’s browser to the return URL
specified in the Pay API operation’s request message.
NOTE: You are responsible for closing the minibrowser after PayPal redirects to the page
specified in either the return or cancel URL. PayPal provides a JavaScript function
that you call to close a PayPal minibrowser or lightbox.
For subsequent payments in which PayPal does not require the account holder to log in again
and the account holder has chosen to be remembered, PayPal bypasses the log in steps.
For example, the lightbox for reviewing a payment would appear in your page as follows:
44August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
The lightbox containing the confirmation would appear in your page as follows:
Adaptive Payments Developer GuideAugust 7, 201245
Introducing Adaptive Payments
Embedded Payments
The actions you take to launch the flow and close the lightbox are the same steps you take for
the minibrowser.
Preapprove Future Payments Checkbox
You can add a Preapprove future payments checkbox to the sender’s embedded payment
experience, which enables the sender to preapprove subsequent payments. If you invoke the
embedded payment flow, passing both a payment key obtained by calling Pay and a
preapproval key obtained by calling Preapproval, PayPal displays the checkbox on the
payment page:
46August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
If the payment sender checks the preapproval box, the confirmation page provides details
about the preapproval:
Adaptive Payments Developer GuideAugust 7, 201247
Introducing Adaptive Payments
Embedded Payments
NOTE: Unless there is an error with the payment itself, PayPal transfers the money regardless
of whether the preapproval for future payments was successful.
Embedded Preapproval Experience
Adaptive Payments provides a preapproval experience using a mini-browser.You can invoke
the embedded preapproval flow by passing the preapproval key. Here is an example :
PayPal first asks the user to log into their PayPal account:
48August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
After signing in, the user is presented with a consent form that the user must agree to:
Adaptive Payments Developer GuideAugust 7, 201249
Introducing Adaptive Payments
Embedded Payments
If the seller has enabled PIN code entry, after consenting to the agreement, the user is
prompted to enter a PIN code by the seller:
50August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
Finally, the user is presented with a confirmation screen:
Adaptive Payments Developer GuideAugust 7, 201251
Introducing Adaptive Payments
Embedded Payments
Shipping Address Selection
You can display and collect shipping address information for a transaction with the embedded
payment flow. PayPal displays the default shipping address when you set
senderOptions.requireShippingAddressSelection to true in your request to
SetPaymentOptions:
52August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
The sender of a payment can select one of the available shipping addresses or add a new
shipping address by selecting Add new shipping address from the Ship to: drop-down menu:
Adaptive Payments Developer GuideAugust 7, 201253
Introducing Adaptive Payments
Embedded Payments
After the sender of the payment clicks Pay, PayPal displays the selected shipping address on
the Thank you for using PayPal page:
54August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
You can call the GetShippingAddresses API operation to obtain the selected shipping
address for the transaction using the key assoicated with the payment.
Setting Up Web Pages to Invoke the Embedded Payment Flow Using a
Lightbox
Use the JavaScript functions in
https://www.paypalobjects.com/js/external/dg.js to set up and control the
embedded payment flow. This example shows how to initiate the embedded payment flow
after obtaining a payment key.
This example assumes that you obtain a payment key before initiating the flow and that the
key does not change or expire before the sender completes the flow.
To set up a web page to invoke the embedded payment flow:
Adaptive Payments Developer GuideAugust 7, 201255
Introducing Adaptive Payments
Embedded Payments
1. Call the Pay API operation to obtain a valid pay key.
– Optionally , include a preapproval key if you want to enable the sel ection of Preapproval
for future payments
– Specify that a lightbox opens in the PayPal-created IFRAME, PPDGFrame.
– Set the expType parameter to indicate your preference for the context in which the
PayPal payment flow is displayed. You must specify light for lightbox.
4. Create an embedded flow object and associate it with your payment form or button.
<script>
var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });
</script>
After Completing This Task:
On the pages you identify as the return and cancel URLs in the Pay API operation, you must
include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the
following example:
dgFlow = top.dgFlow || top.opener.top.dgFlow;
dgFlow.closeFlow();
top.close();
56August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Embedded Payments
Setting Up Web Pages to Invoke the Embedded Payment Flow Using a
Minibrowser
Use the JavaScript functions in
https://www.paypalobjects.com/js/external/apdg.js to set up and control the
embedded payment flow. This example shows how to initiate the embedded payment flow
after obtaining a payment key.
This example assumes that you obtain a payment key before initiating the flow and that the
key does not change or expire before the sender completes the flow.
To set up a web page to invoke the embedded payment flow:
1. Call the Pay API operation to obtain a valid pay key.
https://www.paypal.com/AdaptivePayments/PaymentDetails)
if echo $PAYMENTDETAILS | grep -q "\&status=COMPLETED"
then echo "Thank you for approving pay key $PAYKEY"
else echo "Sorry, you were unable to approve pay key $PAYKEY. Please try
another transaction!"
fi
Displaying and Collecting Shipping Addresses
PayPal displays the default shipping address and allows the payment sender to change the
address when you set senderOptions.requireShippingAddressSelection to true
in your request to the SetPaymentOptions API operation. You call the
GetShippingAddresses API operation to obtain the selected shipping address after
invoking the embedded payment flow.
The steps in this example assume that you have implemented the JavaScript for invoking the
embedded payment flow, that you have set up your button or form to invoke the flow, and that
you have included the code to close the window associated with the flow.
To display and collect the selected shipping address
1. Call the Pay API operation with actionType set to CREATE to obtain a payment key.
2. Set senderOptions.requireShippingAddressSelection to true in your request
to SetPaymentOptions and call the API operation.
58August 7, 2012Adaptive Payments Developer Guide
3. Redirect the payment sender’s browser to the embedded payment flow at
https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=...
after obtaining the pay key.
4. After returning from the flow, call the GetShippingAddresses API operation to obtain
the selected shipping address.
Guest Payments
Adaptive payments supports guest payments, which are payments using a sender’s credit card
without logging into PayPal to complete the transaction.The sender is not explicitly identified
as a PayPal account holder during the transaction and is not required to have a PayPal account.
Each receiver of a guest payment must be a verified PayPal Business Verified or Premier
Verified account holder.
PayPal handles guest payments in the same way that it handles explicitly approved payments.
Instead of logging into PayPal to complete transaction, the sender provides credit card
information on the PayPal payment screen:
Introducing Adaptive Payments
Guest Payments
Adaptive Payments Developer GuideAugust 7, 201259
Introducing Adaptive Payments
Fee Payment Configuration
NOTE: For European Union countries, only 10 guest payments are allowed per card.
Fee Payment Configuration
You can set up a payment transaction so that either the sender of a payment pays the fee or the
receivers of a payment pay the fee. If receivers pay the fee, you can specify whether the
60August 7, 2012Adaptive Payments Developer Guide
primary receiver in a chained payment pays the entire fee or whether all receivers pay a
portion of the fee.
You can specify who pays these fees. Fee payment configurations include:
Sender Pays the Fee
Receiver Pays the Fee in a Parallel Payment
Each Receiver Pays the Fee in a Chained Payment
Primary Receiver Pays the Fee in a Chained Payment
NOTE: Fees are determined by PayPal and are based on criteria, such as the transaction
volume of the receiver. In the examples that follow, the fees shown are representative
only and not actual fees.
Sender Pays the Fee
The sender can pay a fee for a simple payment, parallel payment, or a chained payment. The
following example shows fees being paid by the sender of a parallel payment, based on the
assessment for each receiver:
Introducing Adaptive Payments
Fee Payment Configuration
In this example, the sender pays a total of $510.83, which includes all fees.
Adaptive Payments Developer GuideAugust 7, 201261
Introducing Adaptive Payments
Fee Payment Configuration
NOTE: The scenario above is an example only and is not representative of actual PayPal fees.
Receiver Pays the Fee in a Parallel Payment
If the receivers pay the fee in a parallel payment, each receiver pays a portion of the fee, based
on their assessment. The following example shows the receivers paying the fees:
NOTE: The scenario above is an example only and is not representative of actual PayPal fees.
Each Receiver Pays the Fee in a Chained Payment
If the receivers pay the fee in a chained payment, each receiver pays a portion of the fee, based
on their assessment. The following example shows the receivers paying the fees:
62August 7, 2012Adaptive Payments Developer Guide
Introducing Adaptive Payments
Fee Payment Configuration
In this example, the primary receiver, identified as the merchant, pays a fee for $20 received.
Each of the other receivers also pay a fee on the amount each receives.
NOTE: The scenario above is an example only and is not representative of actual PayPal fees.
Primary Receiver Pays the Fee in a Chained Payment
If only the primary receiver pays the fee in a chained payment, other receivers pay no fees.
The fees paid by the primary receiver, however, are based upon the total fees assigned to all
receivers. The following example shows only the primary receiver, identified as the merchant,
paying all fees:
Adaptive Payments Developer GuideAugust 7, 201263
Introducing Adaptive Payments
Fee Payment Configuration
NOTE: The scenario above is an example only and is not representative of actual PayPal fees.
64August 7, 2012Adaptive Payments Developer Guide
Getting Started
2
These basic scenarios get you up and running quickly with the Adaptive Payments API. The
sample code shows different combinations of requests with different bindings in various
programming languages.
Adaptive Payments API Operations
Adaptive Payments provides API operations, enabling you to build an applicatio n that handles
payments, preapprovals for payments, refunds, and additional operations related to payments.
Some kinds of payments and operations require specific permission to use.
API Operations Related to Payments
API OperationDescription
PayTransfers funds from a sender’s PayPal account to one or more
receivers’ PayPal accounts (up to 6 receivers)
PaymentDetailsObtains information about a payment created with the Pay API
operation
ExecutePaymentExecutes a payment
GetPaymentOptionsObtain the settings specified with the SetPaymentOptions API
operation
SetPaymentOptionsSets payment options
API Operations Related to Preapprovals
API OperationDescription
PreapprovalSets up preapprovals, which is an approval to make future payments
on the sender’s behalf
PreapprovalDetailsObtains information about a preapproval
CancelPreapprovalCancels a preapproval
ConfirmPreapprovalConfirms that you can use the specified preapproval to make
payments
Adaptive Payments Developer GuideAugust 7, 201265
Getting Started
Adaptive Payments Endpoints
Other API Operations
API OperationDescription
RefundRefunds all or part of a payment
ConvertCurrencyObtains the current foreign exchange (FX) rate for a specific amount
and currency
GetFundingPlansDetermines the funding sources that are available for a specified
payment
GetAllowedFundingSourcesObtains the funding sources associated with a preapproval.
GetShippingAddressesObtains the selected shipping address
GetAvailableShippingAddressesObtains available shipping addresses
Adaptive Payments Endpoints
The endpoint is determined by the API operation and the environment in which you want to
execute the API operation. For example, if you want to send a Pay request to the sandbox
endpoint, specify the following URL:
Each request message includes HTTP headers specifying authentication, the application ID,
the device ID or IP address, and the payload format or protocol (SOAP).
Adaptive Payments supports request bodies with JSON, NVP, and XML data formats for
REST implementations. You can specify different formats for the request and response, such
as sending the request in JSON and requesting an XML response.
66August 7, 2012Adaptive Payments Developer Guide
For SOAP, you must also include a specific SOAP protocol header (see the SOAP messages
section).
The following is an example of HTTP headers for NVP in Java for a web implementation:
Use your PayPal account API credentials to authenticate your application. Your API
credentials include an API username and API password. If you are using 3-token
authentication, you must also specify an API signature. If you are using a certificate, the
certificate is used with the username and password; the signature is not used. To specify API
credentials, include the following HTTP headers in your request message (observing case
sensitivity):
Getting Started
HTTP Headers
HTTP Headers for Authentication
Header Description
X-PAYPAL-SECURITY-USERID Your API username
X-PAYPAL-SECURITY-PASSWORD Your API password
X-PAYPAL-SECURITY-SIGNATURE Your API signature, which is required only if you use 3-
token authorization; a certificate does not use a signature
X-PAYPAL-SECURITY-SUBJECTThird-party permission specification, which specifies the
email address or phone number (for mobile) of the party on
whose behalf you are calling the API operation. The subject
must grant you third-party access in their PayPal profile.
NOTE: Resources specified by the API operation, such as a
payment or preapproval identified b y a key, must be
owned by the subject granting the third-party
permission.
Specifying JSON, NVP, or XML Data Formats
Use the HTTP header X-PAYPAL-REQUEST-DATA-FORMAT to specify the data format the
request body. You can send messages using JSON, NVP or straight XML.
Use the and X-PAYPAL-RESPONSE-DATA-FORMAT headers to specify the data format for the
response.
Adaptive Payments Developer GuideAugust 7, 201267
Getting Started
HTTP Headers
For SOAP messages, refer to the next section.
HTTP Headers for JSON, NVP, and XML Data Formats
HeaderDescription
X-PAYPAL-REQUEST-DATA-FORMATThe payload format for the request.
Allowable values are:
NV – Name-value pairs
XML – Extensible markup language
JSON – JavaScript object notation
X-PAYPAL-RESPONSE-DATA-FORMATThe payload format for the response.
Allowable values are:
NV – Name-value pairs
XML – Extensible markup language
JSON – JavaScript object notation
SOAP Messages
To use Adaptive Payments with SOAP, include the HTTP headers for authentication as
described in the section Authentication and the application ID as described in the next section.
In addition, include the X-PAYPAL-MESSAGE-PROTOCOL header with a SOAP11 value.
The following is a header example for an Adaptive Payments API call for a SOAP message:
You also must identify the application. Y o u can op tion all y identify other information
associated with the client and the API version:
68August 7, 2012Adaptive Payments Developer Guide
Getting Started
Making a Simple Payment (JSON)
HTTP Headers for Application and Device identification
HeaderDescription
X-PAYPAL-APPLICATION-ID(Required) Your application’s identification, which is issued
by PayPal.
NOTE: Check X.com for which application ID must be
defined for working in the sandbox.
X-PAYPAL-DEVICE-ID(Optional) Client’s device ID, such as a mobile device’s
IMEI number or a web browser cookie.
X-PAYPAL-DEVICE-IPADDRESS(Required) Client’s IP address.
X-PAYPAL-SERVICE-VERSION(Optional) The version of an API operation to use. By
default, PayPal executes a request with the current version
of an API operation.
NOTE: PayPal recommends not specifying a version unless
it is absolutely required.
Making a Simple Payment (JSON)
A simple payment is when a sender (whose account is debited) sends a payment (amount and
currency) to a single receiver (whose account is credited).
You send a PayRequest message to PayPal
You receive a response with a pay key.
You must redirect the sender’s browser to PayPal to approve the payment.
The response includes a pay key, which is a token you use in subsequent calls to Adaptive
Payments APIs to identify this particular payment.
Adaptive Payments Developer GuideAugust 7, 201269
Getting Started
Making a Parallel Payment (NVP)
In this particular scenario, the paymentExecStatus variable is set to CREATED instead of
COMPLETED, which indicates that the payment has been created, but has not yet been executed.
Making a Parallel Payment (NVP)
A parallel payment is when a sender (whose account is debited) sends a single payment
(amount and currency) up to 6 receivers. The sender can see each payment to a receiver.
You send a PayRequest, specifying an amount to be paid for each receiver.
You receive a response with a pay key.
You must redirect the sender’s browser to PayPal to approve the payment.
In the example below, Paul makes a single payment of $14, which is split into a $9 payment to
Andrea and a $5 payment to Linda. The following event sequence takes place:
The response includes a pay key, which is a token you use in subsequent calls to Adaptive
Payments APIs to identify this particular payment.
In this particular scenario, the paymentExecStatus variable is set to CREATED instead of
COMPLETED, which indicates that the payment has been created, but has not yet been executed.
70August 7, 2012Adaptive Payments Developer Guide
Making a Chained Payment (XML)
A chained payment is when a sender sends a payment to a PayPal-registered receiver who is
the primary receiver.
You send a PayRequest, enabling the primary receiver.
You receive a response with a pay key.
You must redirect the sender’s browser to PayPal to approve the payment.
With chained payments, the sender only sees the transaction to the primary API caller. The
receiver only sees the transaction from the primary API caller. The transactions from and to
the receivers are hidden from the sender and receivers.
In the example below, Tim makes a single payment of $100 to Frank, who is the primary
receiver. Of this amount, Frank keeps $25 and pays Yvonne $75. The following event
sequence takes place:
The response includes a pay key, which is a token you use in subsequent calls to Adaptive
Payments APIs to identify this particular payment.
In this particular scenario, the paymentExecStatus variable is set to CREATED instead of
COMPLETED, which indicates that the payment has been created, but has not yet been executed.
72August 7, 2012Adaptive Payments Developer Guide
Pay API Operation
3
Use the Pay API operation to transfer funds from a sender’s PayPal account to one or more
receivers’ PayPal accounts. You can use the Pay API operation to make simple payments,
chained payments, or parallel payments; these payments can be explicitly approved,
preapproved, or implicitly approved.
Pay Summary
Create your PayRequest message by setting the common fields. If you want more than a
simple payment, add fields for the specific kind of request, which include parallel payments,
chained payments, implicit payments, and preapproved payments.
Common Fields for All Payments
For each kind of payment, you must specify values for the fo llowing fields:
FieldDescription
actionTypeThe action for this request. Possible values are:
PAY – Use this option if you are not using the Pay
request in combination with ExecutePayment.
CREATE – Use this option to set up the payment
instructions with SetPaymentOptions and then
execute the payment at a later time with the
ExecutePayment.
PAY_PRIMARY – For chained payments only, specify this
value to delay payments to the secondary receivers; only
the payment to the primary receiver is processed.
receiverList.receiver(0).emailA receiver’s email address
receiverList.receiver(0).amountAmount to be credited to the receiver’s account
currencyCodeThe code for the currency in which the payment is made;
you can specify only one currency, regardless of the number
of receivers
cancelUrlURL to redirect the sender’s browser to after canceling the
approval for a payment; it is always required but only used
for payments that require approval (explicit payments)
Adaptive Payments Developer GuideAugust 7, 201273
Pay API Operation
Pay Summary
FieldDescription
returnUrlURL to redirect the sender’s browser to after the sender has
logged into PayPal and approved a payment; it is always
required but only used if a payment requires explicit
approval
requestEnvelope.errorLanguageThe code for the language in which errors are returned,
which must be en_US.
Parallel Payments
For a simple payment, you must specify values for the fields above. For a parallel payment,
you must specify both the above values and the following fields:
FieldDescription
receiverList.receiver(
receiverList.receiver(
n).emailThe receiver ’s email address for each receiver, where n is
between 0 and 5 for a maximum of 6 receivers
n).amountAmount to send to each corresponding receiver
Chained Payments
For a chained payment, you must specify all required fields for a parallel payment and you
must also specify enable the primary receiver:
FieldDescription
receiverList.receiver(
receiverList.receiver(
receiverList.receiver(
By default, a payment requires explicit approval in which the sender must log in to PayPal. In
that case, you are not required to specify the sender’s email address. To initiate the approval
process, you must redirect the sender to PayPal as follows:
n).emailThe receivers’ email addresses, where n is between 0 and 5
for a total of one primary receiver and between one and 5
secondary receivers
n).amountAmount to send to each corresponding receiver
n).primarySet to true to indicate a chained payment; only one receiver
can be a primary receiver. Omit this field, or set it to false
for simple and parallel payments.
NOTE: The command is _ap-payment. You obtain the value of the paykey parameter from
the payKey field in the Pay API operation’s response message.
74August 7, 2012Adaptive Payments Developer Guide
Pay API Operation
Pay Summary
Implicit Payments
If you are the API caller and you specify your email address in the senderEmail field,
PayPal implicitly approves the payment without redirecting to PayPal:
FieldDescription
senderEmailSender’s email address
Preapproved Payments
If the sender has set up a preapproval, you can use the preapproval to avoid explicit approval.
In that case, you must specify values for the fields below.
FieldDescription
preapprovalKeyPreapproval key for the approval set up between you and the
sender
pinSender’s personal identification number, if one was
specified when the sender agreed to the approval
Payments for Digital Goods
You handle payments for digita l goods in the same way you handle payments for other goods
and services, with the following exceptions:
T o specify a payment for digital goods, you must specify DIGITALGOODS for each receiver
in your receiver list; specify
receiverList.receiver(
where
n identifies the receiver, starting with 0.
If you specify a payment for digital goods, you cannot specify a senderEmail address or
n).paymentType=DIGITALGOODS for each receiver,
include a funding constraint.
You must redirect the sender to the following PayPal URL to complete the payment for
Notifications are sent after payment is executed, which follows approval of the payment by the
sender if required:
PayPal sends an email to the sender and all receivers associated with a payment when the
transfer is complete; you receive an email only if you are also the payment sender or
receiver.
Adaptive Payments Developer GuideAugust 7, 201275
Pay API Operation
Pay Summary
When the payment is complete, PayPal sends an IPN message to the URL specified in the
ipnNotificationUrl field of the Pay request.
Additional Notes About the Pay API Operation
1. With parallel payments, fund transfers to some receivers may occur before others.
Therefore, set reverseAllParallelPaymentsOnError to true. In the event of an
error, this setting guarantees that transfers to all receivers are reversed and all funds are
returned to the sender. If reverseAllParallelPaymentsonError is disabled,
completed transfers are not reversed and funds that have already been transferred are no
longer available to the sender.
2. You can specify your own unique tracking ID in the trackingID field and use this value
to obtain information about a payment or to request a refund. The tracking ID is provided
as a convenience in cases when you already maintain an ID that you want to associate with
a payment. You can also track payments using the payKey.
3. You can use the Pay API operation to make unilateral payments under limited
circumstances. A unilateral payment is a payment that is made to a receiver who does not
have a PayPal account. Unilateral payments can be used with simple or parallel payments
that are implicit or preapproved. Unilateral payments are not designed to be used with
chained payments or payments that require manual approval through the web flow.
When you send a unilateral payment, you send a payment request that includes an email
address for a receiver, and this email address is not linked to a registered PayPal account.
The receiver receives an email notifying the receiver to create an account and claim the
payment.
PayPal holds a payment to a receiver whose email address is not yet registered or
confirmed until the receiver creates a PayPal account and confirms the email address. If a
refund specifies a receiver whose email address is not yet registered or confirmed, the
payment to the receiver is canceled.
4. For a guest payment, do not set the sender’s email address or the preapproval key.
Specifying the sender’s email address prevents the sender from choosing the guest payment
option. Implicit approval and preapproval options are not allowed. Each receiver of a guest
payment must be a verified PayPal business or premier account holder.
5. You can specify a value for either senderEmail or one of the SenderIdentifier
fields. If you use SenderIdentifier to identify the sender, you can only specify
sender.email or set sender.useCredentials to true, but not both;
sender.phone is reserved for future use.
6. Specify senderEmail or sender.email to set up a payment where the sender and the
API caller are the same (implicit approval) or for a preapproved payment.
7. If senderEmail or sender.email is specified in the request, the email address must be
registered with paypal.com. If you do not include one of these fields in the payment
request, the sender can either log in using an existing account that is not associated with a
receiver or create a new account during the payment flow.
76August 7, 2012Adaptive Payments Developer Guide
PayRequest Message
The PayRequest message contains the instructions required to make a payment.
Pay API Operation
PayRequest Message
Adaptive Payments Developer GuideAugust 7, 201277
Pay API Operation
PayRequest Message
78August 7, 2012Adaptive Payments Developer Guide
PayRequest Fields
FieldDescription
actionTypexs:string
(Required) Whether the Pay request pays the receiver or whether the Pay
request is set up to create a payment request, but not fulfill the payment until
the ExecutePayment is called.
Allowable values are:
PAY – Use this option if you are not using the Pay request in combination
with ExecutePayment.
CREATE – Use this option to set up the payment instructions with
SetPaymentOptions and then execute the payment at a later time with
the ExecutePayment.
PAY_PRIMARY – For chained payments only, specify this value to delay
payments to the secondary receivers; only the payment to the primary
receiver is processed.
cancelUrlxs:string
(Required) The URL to which the sender’s browser is redirected if the sender
cancels the approval for the payment after logging in to paypal.com to approve
the payment. Specify the URL with the HTTP or HTTPS.
Maximum length: 1024 characters
Pay API Operation
PayRequest Message
clientDetailscommon:ClientDetailsType
(Optional) Information about the sender.
Adaptive Payments Developer GuideAugust 7, 201279
Pay API Operation
PayRequest Message
FieldDescription
currencyCodexs:string
(Required) The currency code. Allowable values are:
Australian Dollar – AUD
Brazilian Real – BRL
NOTE: The Real is supported as a payment currency and currency balance
only for Brazilian PayPal accounts.
Canadian Dollar – CAD
Czech Koruna – CZK
Danish Krone – DKK
Euro – EUR
Hong Kong Dollar – HKD
Hungarian Forint – HUF
Israeli New Sheqel – ILS
Japanese Yen – JPY
Malaysian Ringgit – MYR
NOTE: The Ringgit is supported as a payment currency and currency balance
only for Malaysian PayPal accounts.
Mexican Peso – MXN
Norwegian Krone – NOK
Ne w Zealand Dollar – NZD
Philippine Peso – PHP
Polish Zloty – PLN
Pound Sterling – GBP
Singapore Dollar – SGD
Swedish Krona – SEK
Swiss Franc – CHF
Taiwan New Dollar – TWD
Thai Baht – THB
Turkish Lira – TRY
NOTE: The Turkish Lira is supported as a payment currency and currency
balance only for Turkish PayPal accounts.
U.S. Dollar – USD
feesPayerxs:string
(Optional) The payer of PayPal fees. Allowable values are:
SENDER – Sender pays all fees (for personal, implicit simple/parallel
payments; do not use for chained or unilateral payments)
PRIMARYRECEIVER – Primary receiver pays all fees (chained payments
only)
EACHRECEIVER – Each receiver pays their own fee (default, personal and
unilateral payments)
SECONDARYONLY – Secondary receivers pay all fees (use only for chained
payments with one secondary receiver)
80August 7, 2012Adaptive Payments Developer Guide
FieldDescription
fundingConstraintap:FundingConstraint
(Optional) Specifies a list of allowed funding types for the payment. This is a
list of funding selections that can be combined in any order to allow payments
to use the indicated funding type. If this Parameter is omitted, the payment can
be funded by any funding type that is supported for Adaptive Payments.
NOTE: FundingConstraint is unavailable to API callers with standard
permission levels; for more information, refer to the section Adaptive
Payments Permission Levels.
ipnNotificationUrlxs:string
(Optional) The URL to which you want all IPN messages for this payment to
be sent.
Maximum length: 1024 characters
memoxs:string
(Optional) A note associated with the payment (text, not HTML).
Maximum length: 1000 characters, including newline characters
Pay API Operation
PayRequest Message
pinxs:string
(Optional) The sender’s personal identification number, which was specified
when the sender signed up for a preapproval.
preapprovalKeyxs:string
(Optional) The key associated with a preapproval for this payment. The
preapproval key is required if this is a preapproved payment.
NOTE: The Preapproval API is unavailable to API callers with Standard
permission levels.
receiverListap:ReceiverList
(Required) Information about the receivers of the payment.
requestenvelopecommon:RequestEnvelope
(Required) Information common to each Method, such as the language in
which an error message is returned.
returnUrlxs:string
(Required) The URL to which the sender’s browser is redirected after
approving a payment on paypal.com. Specify the URL with the HTTP or
HTTPS designator.
Maximum length: 1024 characters
reverseAllParallelPaymen
tsOnError
xs:boolean
(Optional) Whether to reverse parallel payments if an error occurs with a
payment.
Allowable values are:
true – Each parallel payment is reversed if an error occurs
false – Only incomplete payments are reversed (default)
Adaptive Payments Developer GuideAugust 7, 201281
Pay API Operation
PayRequest Message
FieldDescription
senderEmailxs:string
(Optional) Sender’s email address.
Maximum length: 127 characters
senderap:SenderIdentifier
(Optional) Sender’s identifying information.
trackingIdxs:string
(Optional) A unique ID that you specify to track the payment.
NOTE: You are responsible for ensuring that the ID is unique.
Maximum length: 127 characters
ClientDetails Fields
Field Description
applicationId xs:string
(Optional) Your application’s identification, such as the name of your
application
customerIdxs:string
(Optional) Your ID for this sender
Maximum length: 127 characters
customerTypexs:string
(Optional) Your identifi cation of the type of customer
Maximum length: 127 characters
deviceIdxs:string
(Optional) Sender’s device ID, such as a mobile device’s IMEI number or a
web browser cookie. If a device ID was passed with the PayRequest, use the
same ID here.
Maximum length: 127 characters
geoLocationxs:string
(Optional) Sender’s geographic location
Maximum length: 127 characters
ipAddressxs:string
(Optional) Sender’s IP address. If an IP addressed was passed with the
PayRequest, use the same ID here.
model xs:string
(Optional) A sub-identification of the application
Maximum length: 127 characters
82August 7, 2012Adaptive Payments Developer Guide
Field Description
partnerName xs:string
(Optional) Your organization’s name or ID
Maximum length: 127 characters
FundingConstraint Fields
FieldDescription
allowedFundingTypeap:FundingTypeList
(Optional) Specifies a list of allowed funding selections for the payment. This
is a list of funding selections that can be combined in any order to allow
payments to use the indicated funding type. If this field is omitted, the payment
can be funded by any funding type that is supported for Adaptive Payments.
NOTE: FundingConstraint is unavailable to API callers with standard
permission levels; for more information, refer to the section Adaptive
Payments Permission Levels.
Pay API Operation
PayRequest Message
NOTE: To use iACH, omit this field and do not specify a funding source for
the payment.
FundingTypeList Fields
FieldDescription
fundingTypeInfoap:FundingTypeInfo
(Optional) Specifies a list of allowed funding selections for the payment. This
is a list of funding selections that can be combined in any order to allow
payments to use the indicated funding type. If this field is omitted, the payment
can be funded by any funding type that is supported for Adaptive Payments.
NOTE: FundingConstraint is unavailable to API callers with standard
permission levels; for more information, refer to the section Adaptive
Payments Permission Levels.
Adaptive Payments Developer GuideAugust 7, 201283
Pay API Operation
PayRequest Message
FundingTypeInfo Fields
FieldDescription
fundingTypexs:string
(Required) Specifies a list of allowed funding selections for the payment. This
is a list of funding selections that can be combined in any order to allow
payments to use the indicated funding type. If this field is omitted, the payment
can be funded by any funding type that is supported for Adaptive Payments.
NOTE: ECHECK and CREDITCARD include BALANCE implicitly.
NOTE: FundingConstraint is unavailable to API callers with standard
permission levels; for more information, refer to the section Adaptive
Payments Permission Levels.
ReceiverList Fields
FieldDescription
receiverap:Receiver
(Required) Receiver is the party whose account is credited.
Receiver Fields
FieldDescription
amountxs:decimal
(Required) Amount to be paid to the receiver.
emailxs:string
Receiver’s email address. This address can be unregistered with paypal.com.
If so, a receiver cannot claim the payment until a PayPal account is linked to
the email address. The PayRequest must pass either an email address or a
phone number.
Maximum length: 127 characters
invoiceIdxs:string
(Optional) The invoice number for the payment. This data in this field shows
on the Transaction Details report.
Maximum length: 127 characters
84August 7, 2012Adaptive Payments Developer Guide
FieldDescription
paymentTypexs:string
(Optional) The transaction type for the payment.
Allowable values are:
GOODS – This is a payment for non-digital goods
SERVICE – This is a payment for services (default)
PERSONAL – This is a person-to-person payment
CASHADVANCE – This is a person-to-person payment for a cash advance
DIGITALGOODS – This is a payment for digital goods
BANK_MANAGED_WITHDRAWAL – This is a person-to-person payment for
bank withdrawals, available only with special permission.
NOTE: Person-to-person payments are valid only for parallel payments that
have the feesPayer field set to EACHRECEIVER or SENDER.
paymentSubTypexs:string
(Optional) The transaction subtype for the payment.
phonecommon:PhoneNumberType
A type to specify the receiver’s phone number. The PayRequest must pass
either an email address or a phone number as the payment receiver.
Pay API Operation
PayRequest Message
primaryxs:boolean
(Optional) Whether this receiver is the primary receiver, which makes the
payment a chained payment. You can specify at most one primary receiver.
Omit this field for simple and parallel payments.
(Optional) If true, use credentials to identify the sender; default is false.
AccountIdentifier Fields
FieldDescription
emailxs:string
(Optional) Sender’s email address.
Maximum length: 127 characters
phonecommon:PhoneNumberType
(Optional) Sender’s phone number.
RequestEnvelope Fields
FieldDescription
detailLevelcommon:DetailLevelCode
(Optional) Level of detail required by the client application pertaining to a
particular data component. The detail level is specified as a detail level code,
which has all the enumerated values of the detail level for the component. By
default, the detail level code is ReturnAll, which provides the maximum
level of detail.
errorLanguagexs:string
(Required) RFC 3066 language in which error messages are returned; by
default it is en_US, which is the only language currently supported.
PayResponse Message
The PayResponse message contains a key that you can use to identify the payment and the
payment’s status.
86August 7, 2012Adaptive Payments Developer Guide
Pay API Operation
PayResponse Message
Adaptive Payments Developer GuideAugust 7, 201287
Pay API Operation
PayResponse Message
88August 7, 2012Adaptive Payments Developer Guide
Pay API Operation
PayResponse Message
Adaptive Payments Developer GuideAugust 7, 201289
Pay API Operation
PayResponse Message
PayResponse Fields
FieldDescription
payKeyxs:string
The pay key, which is a token you use in other Adaptive Payment APIs (such
as the Refund Method) to identify this payment. The pay key is valid for 3 hours; the payment must be approved while the pay key is valid.
payErrorListxs:string
Information about why a payment failed.
paymentExecStatusxs:string
The status of the payment. Possible values are:
CREATED – The payment request was received; funds will be transferred
once the payment is approved
COMPLETED – The payment was successful
INCOMPLETE – Some transfers succeeded and some failed for a parallel
payment or, for a delayed chained payment, secondary receivers have not
been paid
ERROR – The payment failed and all attempted transfers failed or all
completed transfers were successfully reversed
REVERSALERROR – One or more transfers failed when attempting to
reverse a payment
PROCESSING – The payment is in progress
PENDING – The payment is awaiting processing
defaultFundingPlanap:FundingPlan
Default funding plan.
responseEnvelopecommon:responseEnvelope
Common response information, including a timestamp and the response
acknowledgement status.
90August 7, 2012Adaptive Payments Developer Guide
Pay API Operation
PayResponse Message
PayErrorList Fields
FieldDescription
payErrorPayError indicates the error, if any, that resulted on an attempted payment to
a receiver.
FundingPlan Fields
FieldDescription
fundingPlanIdxs:string
ID for this funding plan.
fundingAmountcommon:CurrencyType
Amount of available funding.
backupFundingSourceap:FundingSource
Backup funding source.
senderFeescommon:CurrencyType
Fees to be paid by the sender.
currencyConversionap:CurrencyConversion
The currency conversion associated with the funding plan.
chargeap:FundingPlanCharge
The amount to be charged to this funding plan.
CurrencyType Fields
FieldDescription
amountxs:decimal
The converted amount.
Adaptive Payments Developer GuideAugust 7, 201291
Pay API Operation
PayResponse Message
FieldDescription
codexs:string
The currency code for the converted amount. Possible values are:
Australian Dollar – AUD
Brazilian Real – BRL
NOTE: The Real is supported as a payment currency and currency balance
only for Brazilian PayPal accounts.
Canadian Dollar – CAD
Czech Koruna – CZK
Danish Krone – DKK
Euro – EUR
Hong Kong Dollar – HKD
Hungarian Forint – HUF
Israeli New Sheqel – ILS
Japanese Yen – JPY
Malaysian Ringgit – MYR
NOTE: The Ringgit is supported as a payment currency and currency balance
only for Malaysian PayPal accounts.
Mexican Peso – MXN
Norwegian Krone – NOK
Ne w Zealand Dollar – NZD
Philippine Peso – PHP
Polish Zloty – PLN
Pound Sterling – GBP
Singapore Dollar – SGD
Swedish Krona – SEK
Swiss Franc – CHF
Taiwan New Dollar – TWD
Thai Baht – THB
Turkish Lira – TRY
NOTE: The Turkish Lira is supported as a payment currency and currency
balance only for Turkish PayPal accounts.
U.S. Dollar – USD
FundingSource Fields
FieldDescription
lastFourOfAccountNumberxs:string
Last 4 digits or characters in account number.
92August 7, 2012Adaptive Payments Developer Guide
FieldDescription
typexs:string
Type of funding source, which is one of the following values:.
Whether the funding source is allowed for this payment:
true – You can use this funding source for the payment
false – You cannot use this funding source (defaul t)
Pay API Operation
PayResponse Message
CurrencyConversion Fields
FieldDescription
fromap:CurrencyType
The currency to be converted.
toap:CurrencyType
The currency resulting from the conversion.
exchangeRatexs:decimal
The exchange rate for the from currency to the to currency.
FundingPlanCharge Fields
FieldDescription
chargecommon:CurrencyType
Amount charged to funding source.
fundingSourceap:FundingSource
Funding source being charged.
Adaptive Payments Developer GuideAugust 7, 201293
Pay API Operation
PayResponse Message
PayError Fields
FieldDescription
errorDetailed error information.
receiverap:Receiver
Receiver is the party where funds are transferred to. A primary receiver
receives a payment directly from the sender in a chained split payment. A
primary receiver should not be specified when making a single or parallel split
payment.
ErrorData Fields
FieldDescription
categorycommon:ErrorCategory
The location where the error occurred.
Possible values are:
System – The system encountered errors; try again
Application – The application encountered errors; try again
Request – The request was incorrect
domainxs:string
The domain to which this service belongs.
errorIdxs:long
A 6-digit number that uniquely identifies a particular error.
exceptionIDThis field is not used.
messagexs:string
A description of the error.
parametercommon:ErrorParameter
Represents contextual information about the error.
severitycommon:ErrorSeverity
The severity of the error encountered.
Possible values are:
Error – Processing of the request was interrupted
Warning – Processing of the request was completed
subdomainThis field is not used.
94August 7, 2012Adaptive Payments Developer Guide
Receiver Fields
FieldDescription
amountxs:decimal
Amount to be paid to the receiver.
emailxs:string
Receiver’s email address.
Maximum length: 127 characters
invoiceIdxs:string
The invoice number for the payment. This data in this field shows on the
Transaction Details report.
Maximum length: 127 characters
paymentTypexs:string
The transaction type for the payment.
Possible values are:
GOODS – This is a payment for non-digital goods
SERVICE – This is a payment for services (default)
PERSONAL – This is a person-to-person payment
CASHADVANCE – This is a person-to-person payment for a cash advance
DIGITALGOODS – This is a payment for digital goods
BANK_MANAGED_WITHDRAWAL – This is a person-to-person payment for
bank withdrawals, available only with special permission.
Pay API Operation
PayResponse Message
paymentSubTypexs:string
The transaction subtype for the payment.
phonecommon:PhoneNumberType
The receiver’s phone number.
primaryxs:boolean
Whether this receiver is the primary receiver . If this field is set to true, this is a
chained payment. If this field shows false, this is a simple or parallel payment.
Acknowledgement code. It is one of the following values:
Success – The operation completed successfully.
Failure – The operation failed.
SuccessWithWarning – The operation completed successfully;
however, there is a warning message.
FailureWithWarning – The operation failed with a warning message.
buildxs:string
Build number. It is used only by PayPal Merchant Technical Support.
correlationIdxs:string
Correlation identifier. It is a 13-character, alphanumeric stri ng (for exam ple,
db87c705a910e) that is used only by PayPal Merchant Technical Support.
NOTE: You must log and store this data for every response you receive.
PayPal Technical Support uses the information to assist with reported
issues.
timestampxs:datetime
Date on which the response was sent, for example:
2012-04-02T22:33:35.774-07:00
NOTE: You must log and store this data for every response you receive.
PayPal Technical Support uses the information to assist with reported
issues.
PPFault Message
The PPFaultMessage returns ErrorData and the ResponseEnvelope information to
your application if an error occurs.
96August 7, 2012Adaptive Payments Developer Guide
Pay API Operation
PPFault Message
FaultMessage Fields
FieldDescription
errorcommon:ErrorData
Detailed error information.
responseEnvelopecommon:ResponseEnvelope
Common response information, including a timestamp and the response
acknowledgement status.
Adaptive Payments Developer GuideAugust 7, 201297
Pay API Operation
PPFault Message
ErrorData Fields
FieldDescription
categorycommon:ErrorCategory
The location where the error occurred.
Possible values are:
System – The system encountered errors; try again
Application – The application encountered errors; try again
Request – The request was incorrect
domainxs:string
The domain to which this service belongs.
errorIdxs:long
A 6-digit number that uniquely identifies a particular error.
exceptionIDThis field is not used.
messagexs:string
A description of the error.
parametercommon:ErrorParameter
Represents contextual information about the error.
severitycommon:ErrorSeverity
The severity of the error encountered.
Possible values are:
Error – Processing of the request was interrupted
Warning – Processing of the request was completed
subdomainThis field is not used.
ResponseEnvelope Fields
FieldDescription
ackcommon:AckCode
Acknowledgement code. It is one of the following values:
Success – The operation completed successfully.
Failure – The operation failed.
SuccessWithWarning – The operation completed successfully;
however, there is a warning message.
FailureWithWarning – The operation failed with a warning message.
buildxs:string
Build number. It is used only by PayPal Merchant Technical Support.
98August 7, 2012Adaptive Payments Developer Guide
FieldDescription
correlationIdxs:string
Correlation identifier. It is a 13-character, alphanumeric stri ng (for exam ple,
db87c705a910e) that is used only by PayPal Merchant Technical Support.
NOTE: You must log and store this data for every response you receive.
PayPal Technical Support uses the information to assist with reported
issues.
timestampxs:datetime
Date on which the response was sent, for example:
2012-04-02T22:33:35.774-07:00
NOTE: You must log and store this data for every response you receive.
PayPal Technical Support uses the information to assist with reported
issues.
Pay Examples Using NVP and CURL
Pay API Operation
Pay Examples Using NVP and CURL
These examples all use NVP for the data binding and CURL to deliver the HTTP request to
the PayPal sandbox endpoint. Line breaks are provided for ease of reading; each CURL
command is a single line and each request and response is a string without line breaks or extra
whitespace.
Simple payment example
In this example, the sender makes a payment of $100 to a PayPal-registered receiver. If you
are the sender and the caller, the approval is implicit; otherwise, the sender must explicitl y
approve the payment.
The status of the request, which is identified in the paymentExecStatus field of the
response, differs due to the kind of approval required. Implicit approval allows the request to
be completed immediately. Explicit approval allows the request to be created; however, it is
completed until the payment is approved.
NOTE: The sample code below uses the insecure setting to work around the certificate for
testing in a sandbox environment. For actual implementations, you must specify the
location of the certificate.
In this example, the sender makes a payment of $100 to a PayPal-registered receiver and $50
to another PayPal-registered receiver. If an error occurs, all funds are returned to the sender
whether or not the funds were transferred to a receiver.
NOTE: The sample code below uses the insecure setting to work around the certificate for
testing in a sandbox environment. For actual implementations, you must specify the
location of the certificate.