Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created August 28, 2012 21:28
Show Gist options
  • Save xcommerce-gists/3504514 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3504514 to your computer and use it in GitHub Desktop.
How to Set Up a Reference Transaction Using Express Checkout.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=CreateBillingAgreement
&VERSION=86
&TOKEN=insert_token_value_here
Response
--------
BILLINGAGREEMENTID=B%2d7FB31251F28061234
&ACK=Success
...
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=DoReferenceTransaction
&VERSION=86
&AMT=50 #The amount the buyer will pay in a payment period
&CURRENCYCODE=USD #The currency, e.g. US dollars
&PAYMENTACTION=SALE #The type of payment
&REFERENCEID=B-7FB31251F28061234 #Billing agreement ID received in the DoExpressCheckoutPayment call
Response
--------
BILLINGAGREEMENTID=B%2d7FB31251F28061234
&ACK=Success
&TRANSACTIONID=98A13946GS4491234
&TRANSACTIONTYPE=merchtpmt
&PAYMENTTYPE=instant
&AMT=50%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=SetExpressCheckout
&VERSION=86
&PAYMENTREQUEST_0_PAYMENTACTION=AUTHORIZATION #Payment authorization
&PAYMENTREQUEST_0_AMT=0 #The amount authorized
&PAYMENTREQUEST_0_CURRENCYCODE=USD #The currency, e.g. US dollars
&L_BILLINGTYPE0=MerchantInitiatedBilling #The type of billing agreement
&L_BILLINGAGREEMENTDESCRIPTION0=ClubUsage #The description of the billing agreement
&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
Response
--------
TOKEN=EC%2d2B984685J43051234
&ACK=Success
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment