How do I set up Express Checkout with Recurring Billing in Payflow?

Use the PayPal SetExpressCheckout API request and the “S” ACTION request in the Payflow API to set up the transaction for Recurring Billing in Payflow.

Set up the transaction:

Note: You can't create Express 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
(
[0] => RESULT=0
[1] => RESPMSG=Approved
[2] => TOKEN=EC-4X323426LW1559921
[3] => CORRELATIONID=c85296249209a
)

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:
https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-4X323426LW1559921

The buyer is redirected and taken to paypal.com, where they sign in to their account or create an account.

Throughout checkout, the buyer sees a box reminding them that they're signing up for recurring billing 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:
RETURNURL=https://www.yoursite.com/return.php

When they return, your URL is then posted some data:
https://www.yoursite.com/return.php?token=EC-4X323426LW1559921&PayerID=5X4X6FQUMKFVA

You also get back the Token and PayerID in the querystring. 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
(
[0] => RESULT=0
[1] => RESPMSG=Approved
[2] => AVSADDR=Y
[3] => AVSZIP=Y
[4] => TOKEN=EC-4X323426LW1559921
[5] => PAYERID=5X4X6FQUMKFVA
[6] => CORRELATIONID=366aff557d376
[7] => EMAIL=customer@domain.com
[8] => PAYERSTATUS=verified
[9] => PHONENUM=408-983-5678
[10] => FIRSTNAME=Nate
[11] => LASTNAME=Tester
[12] => SHIPTOBUSINESS=Nate's Test Acct
[13] => SHIPTOSTREET=1 Main St
[14] => SHIPTOCITY=San Jose
[15] => SHIPTOSTATE=CA
[16] => SHIPTOZIP=95131
[17] => SHIPTOCOUNTRY=US
[18] => SHIPTONAME=Nate's Test Acct
[19] => COUNTRYCODE=US
[20] => ADDRESSSTATUS=Y
)

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
(
[0] => RESULT=0
[1] => PNREF=E34P0A4153B8
[2] => RESPMSG=Approved
[3] => AVSADDR=Y
[4] => AVSZIP=Y
[5] => TOKEN=EC-4X323426LW1559921
[6] => PAYERID=5X4X6FQUMKFVA
[7] => PPREF=0BM04086WX4520323
[8] => CORRELATIONID=1b39c472948c5
[9] => FEEAMT=0.59
[10] => BAID=B-0LT60093PA8952305
[11] => PAYMENTTYPE=instant
[12] => PENDINGREASON=completed
)

In the API response for the "D" ACTION, you get a Billing Agreement ID (BAID), which you'll need to create the Recurring Billing Profile call.

More ways we can help

We'll use cookies to improve and customise your experience if you continue to browse. Is it OK if we also use cookies to show you personalised ads? Learn more and manage your cookies