Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created October 31, 2012 21:47
Show Gist options
  • Save xcommerce-gists/3990132 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3990132 to your computer and use it in GitHub Desktop.
How to Create and Process an Order 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=DoAuthorization
&VERSION=95
&TRANSACTIONID=O-2GN90824037101234 #URL-decoded value of PAYMENTINFO_0_TRANSACTIONID field, from the DoExpressCheckoutPayment response
&AMT=11 #Amount of this authorization
&CURRENCYCODE=USD
Response
--------
TRANSACTIONID=75324566RU7001234 #For use in a DoCapture API call
&AMT=11%2e00
&CURRENCYCODE=USD
&ACK=Success
&PAYMENTSTATUS=Pending
&PENDINGREASON=authorization
...
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=75324566RU7001234 #Specify the DoAuthorization response's TRANSACTIONID value
&AMT=11
&CURRENCYCODE=USD
&COMPLETETYPE=NotComplete #If more authorizations will occur for this order, specify NotComplete; otherwise, specify Complete
Response
--------
AUTHORIZATIONID=75324566RU7001234
&ACK=Success
&TRANSACTIONID=0HL73671RY5781234
&PARENTTRANSACTIONID=75324566RU7001234
&TRANSACTIONTYPE=expresscheckout
&PAYMENTTYPE=instant
&ORDERTIME=2012%2d10%2d31T00%3a49%3a28Z
&AMT=11%2e00
&FEEAMT=0%2e62
&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-40319508UX6051234 #URL-decoded token obtained from the SetExpressCheckout response
&PAYERID=3TXTXECKF1234 #Customer account ID, obtained from the GetExpressCheckoutDetails response
&PAYMENTREQUEST_0_PAYMENTACTION=Order #Creates an order, including an agreement to pay multiple authorized amounts
&PAYMENTREQUEST_0_AMT=20 #The amount authorized for the order
&PAYMENTREQUEST_0_CURRENCYCODE=USD
Response
--------
TOKEN=EC%2d40319508UX6051234
&ACK=Success
&PAYMENTINFO_0_TRANSACTIONID=O%2d2GN90824037101234 #URL-decode this value for use in the DoAuthorization API calls
&PAYMENTINFO_0_ORDERTIME=2012%2d10%2d31T00%3a43%3a00Z
&PAYMENTINFO_0_AMT=20%2e00
&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-40319508UX6051234 #URL-decoded token obtained in the SetExpressCheckout response
Response
--------
TOKEN=EC%2d40319508UX6051234
&ACK=Success
&PAYERID=3TXTXECKF1234 #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=Order #Sets up an authorization for an order
&PAYMENTREQUEST_0_AMT=20 #The amount authorized
&PAYMENTREQUEST_0_CURRENCYCODE=USD #The currency, e.g. US dollars
&cancelUrl=http://www.yourdomain.com/cancel.html
&returnUrl=http://www.yourdomain.com/success.html
Response
--------
TOKEN=EC%2d40319508UX6051234
&ACK=Success
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment