How do I use Express Checkout with Reference Transactions and Payflow Pro?
To perform Reference Transactions with the Payflow API, you must be using Payflow Pro or Website Payments Pro Payflow Edition.
Enable Reference Transactions
To process Reference Transactions, you must enable this feature on both your Payflow Pro and PayPal accounts. You must have admin permissions to perform these steps.
Payflow Pro account:
- Log in to PayPal Manager.
- Click Account Administration.
- Click Transaction Settings.
- Set Allow Reference Transactions to Yes.
- Click Confirm.
- Reference Transactions are automatically enabled on Sandbox accounts created after December 15, 2015.
- If your Sandbox account was created before this date, contact PayPal's Customer Service and ask to have Reference Transactions enabled on your Sandbox account.
- PayPal must approve enablement of Reference Transactions for your Live account.
- To request approval for your Live account, contact PayPal's Customer Service.
Perform Reference Transactions
After the Reference Transactions feature has been enabled on your account, you'll be able to perform Reference Transactions using Express Checkout. As with any Express Checkout API call, you must first set up the Express Checkout Token: SetExpressCheckout Request
SetExpressCheckout API call
USER=xxxx PWD=xxxxxx VENDOR=xxxxxxx PARTNER=PayPal TRXTYPE=A TENDER=P ACTION=S AMT=1.00 CURRENCY=USD RETURNURL=https://localhost/return.php CANCELURL=https://localhost BILLINGTYPE=MerchantInitiatedBilling BA_DESC=TestBA
SetExpressCheckout API response
Array (  => RESULT=0  => RESPMSG=Approved  => TOKEN=EC-71R89077TF0534055  => CORRELATIONID=8610b9bb780fc )
You'll then redirect to the appropriate URL as normal:
When the customer is returned to the RETURNURL as specified in the SetExpressCheckout API Call, you'll get the Token and PayerID posted to you:
You can then take that Token and the PayerID to make the other calls.
Create a Billing Agreement ID (BAID)
To create the BAID, make the following API call (note that "ACTION=X").
USER=xxxx PWD=xxxx VENDOR=xxxxx PARTNER=PayPal TENDER=P TRXTYPE=A ACTION=X TOKEN=EC-71R89077TF0534055
The response contains the BAID:
Array (  => RESULT=0  => PNREF=E15P2EB5B6AF  => RESPMSG=Approved  => TOKEN=EC-71R89077TF0534055  => CORRELATIONID=4f0614e13db1b  => BAID=B-9B302069LC631824C )
You should store the BAID number associated with a specified user so you can bill them later using Reference Transactions.
Example Reference Transaction with BAID
An example of a Reference Transaction using the BAID follows.
Reference Transaction API request
USER=xxxx PWD=xxx VENDOR=xxxx PARTNER=PayPal TENDER=P TRXTYPE=S ACTION=D AMT=25.00 BAID=B-9B302069LC631824C
Note that the preceding request references the BAID from the response of the set of calls.
Reference Transaction API response
Array (  => RESULT=0  => PNREF=E14P2EB5B7EC  => RESPMSG=Approved  => PPREF=3X3017474T589152S  => CORRELATIONID=8b4fabed70e98  => FEEAMT=1.03  => BAID=B-9B302069LC631824C  => PAYMENTTYPE=instant  => PENDINGREASON=completed )
Your Result is 0, and you get back your PayPal Reference Transaction ID (PPREF) and your Payflow Transaction ID (PNREF).
You can continue to use the BAID to make the Reference Transactions in the future. The BAID remains valid until canceled by the buyer or merchant.
Express Checkout for Payflow Guide