How do I set up Checkout with Recurring Billing in Payflow?
You can use Recurring Billing with the Payflow API for Checkout. Using Recurring Billing with Payflow is much like Recurring Payments with the PayPal API; you're just passing different variables, but the logic itself is much the same.
First, as always when working with Checkout, you must set up the transaction.
- In the PayPal API, use the SetExpressCheckout method.
- In Payflow, use the "S" ACTION Request.
Note: You can't create Checkout Recurring Billing Profiles within PayPal Manager.
"S" ACTION request
USER=MERCHANTLOGIN PWD=PASSWORD VENDOR=MERCHANTLOGIN PARTNER=PayPal TRXTYPE=S TENDER=P ACTION=S AMT=10.00 CURRENCY=USD RETURNURL=https://www.yoursite.com/return.php CANCELURL=https://localhost ORDERDESC=test order BILLINGTYPE=RecurringBilling
"S" ACTION response
Array (  => RESULT=0  => RESPMSG=Approved  => TOKEN=EC-4X323426LW1559921  => CORRELATIONID=c85296249209a )
As shown in the code sample, a return Token is appended to the PayPal URL:
https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=<Token>, where <Token> is the value of the Token returned from the API call:
At this point, the user is redirected and taken to PayPal.com, where they sign in to their account or create an account through our account creation flow.
Throughout checkout, the user sees a box reminding them that they're signing up for recurring billings from your service, where Your Business Name is the business name on your PayPal account. When the user clicks Agree and Continue, they're sent to your RETURNURL as set in the "S" call:
When they return, your URL is then posted some data:
You also get back the Token and PayerID in the querystring. You then invoke the "G" ACTION or GetExpressCheckoutDetails API call.
"G" ACTION request
USER=MERCHANTLOGIN PWD=PASSWORD VENDOR=MERCHANTLOGIN PARTNER=PayPal TRXTYPE=S TENDER=P ACTION=G TOKEN=EC-4X323426LW1559921
"G" ACTION response
Array (  => RESULT=0  => RESPMSG=Approved  => AVSADDR=Y  => AVSZIP=Y  => TOKEN=EC-4X323426LW1559921  => PAYERID=5X4X6FQUMKFVA  => CORRELATIONID=366aff557d376  => EMAILemail@example.com  => PAYERSTATUS=verified  => PHONENUM=408-983-5678  => FIRSTNAME=Nate  => LASTNAME=Tester  => SHIPTOBUSINESS=Nate's Test Acct  => SHIPTOSTREET=1 Main St  => SHIPTOCITY=San Jose  => SHIPTOSTATE=CA  => SHIPTOZIP=95131  => SHIPTOCOUNTRY=US  => SHIPTONAME=Nate's Test Acct  => COUNTRYCODE=US  => ADDRESSSTATUS=Y )
You parse out the response information and display it to the user. They click Confirm and you make the "D" ACTION call or DoExpressCheckoutPayment call:
"D" ACTION request
USER=MERCHANTLOGIN PWD=PASSWORD VENDOR=MERCHANTLOGIN PARTNER=PayPal TRXTYPE=S TENDER=P ACTION=D TOKEN=EC-4X323426LW1559921 PAYERID=5X4X6FQUMKFVA AMT=10.00 CURRENCY=USD ORDERDESC=test order
"D" ACTION response
Array (  => RESULT=0  => PNREF=E34P0A4153B8  => RESPMSG=Approved  => AVSADDR=Y  => AVSZIP=Y  => TOKEN=EC-4X323426LW1559921  => PAYERID=5X4X6FQUMKFVA  => PPREF=0BM04086WX4520323  => CORRELATIONID=1b39c472948c5  => FEEAMT=0.59  => BAID=B-0LT60093PA8952305  => PAYMENTTYPE=instant  => PENDINGREASON=completed )
In the API response for the "D" ACTION, you get a BAID, which you'll need to use to create the Recurring Billing Profile call.
To create the Recurring Billing Profile, you use an "A" ACTION to Add a Recurring Billing Profile. Use a TRXTYPE of R to specify "Recurring," and you'll pass the BAID as the Reference Point for the TENDER of P for "PayPal."
"A" ACTION request
USER=MERCHANTLOGIN PWD=PASSWORD VENDOR=MERCHANTLOGIN PARTNER=PayPal ACTION=A TENDER=P TRXTYPE=R PROFILENAME=UserProfile BAID=B-0LT60093PA8952305 AMT=1.00 START=03112011 TERM=0 PAYPERIOD=MONT MAXFAILEDPAYMENTS=0 RETRYNUMDAYS=5 EMAILfirstname.lastname@example.org DESC=RecurringProfile COMPANYNAME=CustomerCompany
"A" ACTION response
Array (  => RESULT=0  => RPREF=R2550A40FC1D  => PROFILEID=RT0000000006  => RESPMSG=Approved )
The PROFILEID is the PROFILE ID that you see in your https://manager.paypal.com account.
For more information, consult the Checkout for Payflow Guide.