Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created September 13, 2012 18:34
Show Gist options
  • Save xcommerce-gists/3716535 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/3716535 to your computer and use it in GitHub Desktop.
How to Offer a Free Trial and Recurring Payments 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=CreateRecurringPaymentsProfile
&VERSION=94
&TOKEN=insert_token_value_here
&PAYERID=payer_id_value #Identifies the customer's account
&PROFILESTARTDATE=2012-09-12T00:00:00Z #Billing date start, in UTC/GMT format
&DESC=PhotoStorage #Profile description - same as billing agreement description
&BILLINGPERIOD=Month #Period of time between billings
&BILLINGFREQUENCY=1 #Frequency of charges
&AMT=1 #The amount the buyer will pay in a payment period
&TRIALBILLINGPERIOD=Month #Period of time in one trial period
&TRIALBILLINGFREQUENCY=1 #Frequency of charges, if any, during the trial period
&TRIALTOTALBILLINGCYCLES=1 #Length of trial period
&TRIALAMT=0 #Payment amount (can be 0) during the trial period
&CURRENCYCODE=USD #The currency, e.g. US dollars
&COUNTRYCODE=US #The country code, e.g. US
&MAXFAILEDPAYMENTS=3 #Maximum failed payments before suspension of the profile
Response
--------
PROFILEID=I%2d6D5UGCVX1234
&PROFILESTATUS=ActiveProfile
&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=GetExpressCheckoutDetails
&VERSION=94
&TOKEN=insert_token_value_here
Response
--------
TOKEN=token_value
&BILLINGAGREEMENTACCEPTEDSTATUS=1
&ACK=Success
&PAYERID=3TXTXECKF1234
...
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=94
&L_BILLINGTYPE0=RecurringPayments #The type of billing agreement
&L_BILLINGAGREEMENTDESCRIPTION0=PhotoStorage #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