Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created August 28, 2012 21:21
Show Gist options
  • Save xcommerce-gists/3504458 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3504458 to your computer and use it in GitHub Desktop.
How to Set Up a Payment Preapproval Using Adaptive Payments.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)
&currencyCode=USD #The currency, e.g. US dollars
&feesPayer=EACHRECEIVER
&memo=Example
&preapprovalKey=PA-5KY19448VE6821234 #The preapproval key received in a Preapproval API response
&receiverList.receiver(0).amount=7.00 #The payment amount
&receiverList.receiver(0).email=insert_email_of_receiver
&senderEmail=insert_email_of_sender
&returnUrl=http://www.yourdomain.com/success.html #For use if the customer proceeds with payment
&cancelUrl=http://www.yourdomain.com/cancel.html #For use if the customer decides not to proceed with payment
&requestEnvelope.errorLanguage=en_US
Response
--------
responseEnvelope.ack=Success
&payKey=AP-7L748474VE7451234 #Value of the pay key, e.g. for use in a PaymentDetails call
&paymentExecStatus=COMPLETED
...
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/Preapproval
Input Parameters
----------------
returnUrl=http://www.yourdomain.com/success.html #For use if the customer proceeds with approval
&cancelUrl=http://www.yourdomain.com/cancel.html #For use if the customer decides not to proceed with approval
&startingDate=2012-04-27T10:45:52Z #First date on which the preapproval is valid
&endingDate=2013-02-02T20:40:52Z #Last date on which the preapproval is valid
&maxAmountPerPayment=35.00 #The maximum amount per payment under the preapproval
&maxNumberOfPayments=20 #The maximum number of payments under the preapproval
&maxTotalAmountOfAllPayments=800.00 #The max of all payments; must be less than, or equal to, $2,000 (or equivalent)
&currencyCode=USD #The currency, e.g. US dollars
&requestEnvelope.errorLanguage=en_US
Response
--------
responseEnvelope.ack=Success
&preapprovalKey=PA-5KY19448VE6821234 #Value of the preapproval key, for use in subsequent steps
...
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/PreapprovalDetails
Input Parameters
----------------
preapprovalKey=PA-5PU68213WY5961234 #Value of the preapproval key, received in the Preapproval call above
&requestEnvelope.errorLanguage=en_US
Response
--------
&responseEnvelope.ack=Success
&approved=true
&cancelUrl=http%3A%2F%2Fwww.yourdomain.com%2Fcancel.html
&curPayments=0
&curPaymentsAmount=0.00
&curPeriodAttempts=0
&currencyCode=USD
&dateOfMonth=0
&dayOfWeek=NO_DAY_SPECIFIED
&endingDate=2013-02-02T20%3A40%3A52.000Z
&maxAmountPerPayment=35.00
&maxNumberOfPayments=20
&maxTotalAmountOfAllPayments=800.00
&paymentPeriod=NO_PERIOD_SPECIFIED
&pinType=NOT_REQUIRED
&returnUrl=http%3A%2F%2Fwww.yourdomain.com%2Fsuccess.html
&senderEmail=insert_sender_email
&startingDate=2012-05-03T10%3A27%3A52.000Z
&status=ACTIVE
&displayMaxTotalAmount=false
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment