Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created October 11, 2012 23:19
Show Gist options
  • Save xcommerce-gists/3876256 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3876256 to your computer and use it in GitHub Desktop.
How to Authorize and Process a Payment Using Express Checkout.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=DoCapture
&VERSION=95
&AUTHORIZATIONID=20K92515TX2901234 #Authorization ID. Specify the value of PAYMENTINFO_0_TRANSACTIONID from the DoExpressCheckoutPayment response)
&AMT=1 #The amount of the payment
&CURRENCYCODE=USD
&COMPLETETYPE=Complete #Indicates that for the authorization specified, this is the last payment capture
Response
--------
AUTHORIZATIONID=20K92515TX2901234
&ACK=Success
&TRANSACTIONID=2KF46316MJ7751234 #New transaction ID for this payment
&PARENTTRANSACTIONID=20K92515TX2901234 #Same as the ID of the original authorization
&TRANSACTIONTYPE=expresscheckout
&PAYMENTTYPE=instant
&AMT=1%2e00
&FEEAMT=0%2e33
&TAXAMT=0%2e00
&CURRENCYCODE=USD
&PAYMENTSTATUS=Completed
...
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=DoExpressCheckoutPayment
&VERSION=95
&TOKEN=EC-470284976K7901234 #Token from the SetExpressCheckout response
&PAYERID=3TXTXECKFU1234 #Customer account ID, from the GetExpressCheckoutDetails response
&PAYMENTREQUEST_0_PAYMENTACTION=Authorization #Enables you to collect payment in the future
&PAYMENTREQUEST_0_AMT=1
&PAYMENTREQUEST_0_CURRENCYCODE=USD
Response
--------
TOKEN=EC%2d470284976K7901234
&ACK=Success
&VERSION=95
&PAYMENTINFO_0_TRANSACTIONID=20K92515TX2901234 #Use this value as the authorization ID in a DoCapture request
&PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=QJSRDC4JW1234
&PAYMENTINFO_0_ACK=Success
...
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=GetExpressCheckoutDetails
&VERSION=95
&TOKEN=EC-470284976K7901234
Response
--------
TOKEN=EC%2d470284976K7901234
&ACK=Success
&PAYERID=3TXTXECKFU1234 #Customer account ID, for use in the DoExpressCheckoutPayment call
...
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=SetExpressCheckout
&VERSION=95
&PAYMENTREQUEST_0_PAYMENTACTION=Authorization #Sets up authorization for a single future payment
&PAYMENTREQUEST_0_AMT=1 #The amount authorized
&PAYMENTREQUEST_0_CURRENCYCODE=USD #The currency, e.g. US dollars
&cancelUrl=http://www.yourdomain.com/cancel.html #For use if the customer decides not to proceed with payment
&returnUrl=http://www.yourdomain.com/success.html #For use if the customer proceeds with payment
Response
--------
TOKEN=EC%2d470284976K7901234
&ACK=Success
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment