Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created August 28, 2012 18:51
Show Gist options
  • Save xcommerce-gists/3502241 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3502241 to your computer and use it in GitHub Desktop.
How to Accept a Basic Digital Goods 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=DoExpressCheckoutPayment
&VERSION=89
&TOKEN=token_value
&PAYERID=3TXTXECKF1234 #From the GetExpressCheckoutDetails response; identifies the customer's account
&PAYMENTREQUEST_0_PAYMENTACTION=SALE #Indicates that a payment will be processed
&PAYMENTREQUEST_0_AMT=21 #The amount of payment
&PAYMENTREQUEST_0_CURRENCYCODE=USD #The currency, e.g. US dollars
Response
--------
TOKEN=token_value
&ACK=Success
&PAYMENTINFO_0_TRANSACTIONID=3CA20865912341234
...
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=89
&TOKEN=token_value
Response
--------
TOKEN=token_value
&ACK=Success
&PAYERID=3TXTXECKF1234 #Identifies the customer's account
&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital
...
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=89
&cancelUrl=http://www.yourdomain.com/cancel.html #For use if the consumer decides not to proceed with payment
&returnUrl=http://www.yourdomain.com/success.html #For use if the consumer proceeds with payment
&PAYMENTREQUEST_0_CURRENCYCODE=USD #The currency, e.g. US dollars
&PAYMENTREQUEST_0_PAYMENTACTION=SALE #Payment for a sale
&PAYMENTREQUEST_0_AMT=21 #The amount authorized
&PAYMENTREQUEST_0_ITEMAMT=21
&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital #The item category must be set to Digital
&L_PAYMENTREQUEST_0_NAME0=my_movie
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_AMT0=21
Response
--------
TOKEN=EC%2d2B984685J43051234
&ACK=Success
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment