Make Parallel Payments with Adaptive Payments

Important: Adaptive Payments is not available for new integrations. PayPal provides this documentation to support existing integrations.

In a parallel payment, a payment is sent to multiple receivers (up to six).

The following samples show POST requests. For information about API credentials and endpoints, see Apps 101.

1. Set up the payment

When a sender is ready to make a parallel payment, use the Pay call to set up the payment. The following input fields include the email addresses of two receivers, but you can specify up to six. Also specify the payment amounts.

The Pay response contains a pay key for use in subsequent steps. For parameter descriptions, see the Pay API Operation.

The following HTTP POST request uses cURL.

HTTP headers
------------
-H "X-PAYPAL-SECURITY-USERID: insert_developer_user_name_here" 
-H "X-PAYPAL-SECURITY-PASSWORD: insert_developer_password_here" 
-H "X-PAYPAL-SECURITY-SIGNATURE: insert_developer_signature_here" 
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" 
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" 
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T"     #Standard sandbox app ID

Endpoint
--------
https://svcs.sandbox.paypal.com/AdaptivePayments/Pay 

Input parameters
----------------
actionType=PAY      #The action taken in the Pay request (that is, the PAY action)
&clientDetails.applicationId=APP-80W284485P519543T #Standard sandbox app ID
&clientDetails.ipAddress=127.0.0.1     #Address from which request is sent  
&senderEmail=sender_email
¤cyCode=USD     #The currency, e.g. US dollars
&receiverList.receiver(0).amount=3.00     #The payment amount for the first receiver 
&receiverList.receiver(0).email=first_receiver_email
&receiverList.receiver(1).amount=4.00   #The payment amount for the second receiver 
&receiverList.receiver(1).email=second_receiver_email
&requestEnvelope.errorLanguage=en_US
&returnUrl=https://example.com/success   #For use if the consumer proceeds with payment
&cancelUrl=https://example.com/cancel    #For use if the consumer decides not to proceed with payment

Response
--------
responseEnvelope.ack=Success
&payKey=AP-70S20255150981234    #Value of the pay key, for use in a redirect to the PayPal site
&paymentExecStatus=CREATED    #Indicates that a payment is set up, ready for a sender to click Pay on the PayPal site
...

2. Redirect the customer to PayPal for authorization

Redirect the customer to PayPal by using the URL-decoded pay key from Step 1, with the PayPal authorization URL, as follows:

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=InsertPayKeyHere

If the customer doesn't provide authorization, the customer is redirected to the cancel URL that you specified in the Pay call, so you can provide a way to re-initiate checkout.

If the customer authorizes the payment, the customer is redirected to the return URL that you specified in the Pay call.

3. Show payment details (optional)

To show payment details, specify the pay key (from Step 1) in a PaymentDetails call. The PaymentDetails call enables you to obtain transaction IDs and other information about the payment. For more information, see PaymentDetails API Operation.

HTTP headers
------------
-H "X-PAYPAL-SECURITY-USERID: insert_developer_user_name" 
-H "X-PAYPAL-SECURITY-PASSWORD: insert_developer_password" 
-H "X-PAYPAL-SECURITY-SIGNATURE: insert_developer_signature" 
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" 
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" 
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T"    #Standard sandbox app ID

Endpoint
--------
https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails 

Input parameters
----------------
payKey=AP-70S20255150981234    #Value of the pay key, received in the previous `Pay` call 
&requestEnvelope.errorLanguage=en_US

Response
--------
responseEnvelope.ack=Success
&cancelUrl=http%3A%2F%2Fwww.yourdomain.com%2Fcancel.html
¤cyCode=USD
&paymentInfoList.paymentInfo(0).transactionId=5XC63659TW0721234
&paymentInfoList.paymentInfo(0).transactionStatus=COMPLETED
&paymentInfoList.paymentInfo(0).receiver.amount=3.00
&paymentInfoList.paymentInfo(0).receiver.email=first_receiver_email
&paymentInfoList.paymentInfo(0).receiver.primary=false
&paymentInfoList.paymentInfo(0).receiver.paymentType=SERVICE
&paymentInfoList.paymentInfo(0).refundedAmount=0.00
&paymentInfoList.paymentInfo(0).pendingRefund=false
&paymentInfoList.paymentInfo(0).senderTransactionId=22K52234553191234
&paymentInfoList.paymentInfo(0).senderTransactionStatus=COMPLETED
&paymentInfoList.paymentInfo(1).transactionId=6B499255JW1421234
&paymentInfoList.paymentInfo(1).transactionStatus=COMPLETED
&paymentInfoList.paymentInfo(1).receiver.amount=4.00
&paymentInfoList.paymentInfo(1).receiver.email=second_receiver_email
&paymentInfoList.paymentInfo(1).receiver.primary=false
&paymentInfoList.paymentInfo(1).receiver.paymentType=SERVICE
&paymentInfoList.paymentInfo(1).refundedAmount=0.00
&paymentInfoList.paymentInfo(1).pendingRefund=false
&paymentInfoList.paymentInfo(1).senderTransactionId=85M38157M2541234
&paymentInfoList.paymentInfo(1).senderTransactionStatus=COMPLETED
&returnUrl=http%3A%2F%2Fwww.yourdomain.com%2Fsuccess.html
&senderEmail=sender_email
&status=COMPLETED
&payKey=AP-70S20255150981234
&actionType=PAY
&feesPayer=EACHRECEIVER
&reverseAllParallelPaymentsOnError=false
&sender.email=sender_email
&sender.useCredentials=false
...
Feedback