Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created August 28, 2012 20:44
Show Gist options
  • Save xcommerce-gists/3504105 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3504105 to your computer and use it in GitHub Desktop.
How to Authorize and Process a Credit Card Payment Using Direct Payment.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=DoCapture
&VERSION=86
&AUTHORIZATIONID=4AA45196YV4521234 #Authorization ID (use the TRANSACTIONID value from the DoDirectPayment response)
&AMT=23 #The amount the payment
&CURRENCYCODE=USD #The currency, e.g. US dollars
&COMPLETETYPE=Complete #Set this to complete if you want to void any remaining authorized amount
Response
--------
AUTHORIZATIONID=4AA45196YV4521234
&ACK=Success
&TRANSACTIONID=37779751K22101234
&PARENTTRANSACTIONID=4AA45196YV4521234
&RECEIPTID=5519%2d4058%2d4751%2d1234
&TRANSACTIONTYPE=webaccept
&PAYMENTTYPE=instant
&ORDERTIME=2012%2d04%2d13T22%3a22%3a38Z
&AMT=23%2e00
&FEEAMT=0%2e97
&TAXAMT=0%2e00
&PAYMENTSTATUS=Completed
...
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=DoDirectPayment
&IPADDRESS=127.0.0.1 #Buyer's IP address, recorded to detect possible fraud
&VERSION=86
&PAYMENTACTION=Authorization #Payment authorization
&AMT=23 #The amount authorized
&ACCT=4641631486853053 #The credit card number
&CREDITCARDTYPE=VISA #The type of credit card
&CVV2=123 #The CVV2 number
&FIRSTNAME=James
&LASTNAME=Smith
&STREET=FirstStreet
&CITY=SanJose
&STATE=CA
&ZIP=95131
&COUNTRYCODE=US
&CURRENCYCODE=USD #The currency, e.g. US dollars
&EXPDATE=052015 #Expiration date of the credit card
Response
--------
&ACK=Success
&AMT=23%2e00
&CURRENCYCODE=USD
&AVSCODE=X
&CVV2MATCH=M
&TRANSACTIONID=4AA45196YV4521234
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment