Sandbox - NVP SOAP API (Classic) - Billing Agreement ID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am testing NVP SOAP API using the Sandbox. When I try to create a reference transaction via API (method POST .../nvp), I get the error:
"L_ERRORCODE0": "11451",
"L_SHORTMESSAGE0": "Billing Agreement Id or transaction Id is not valid".
- Do I need to enable reference transactions on my sandbox business account? If so, how? I've searched the profile and cant find anything to set this.
- My sandbox business account is [removed]. PayPal Merchant ID AW94X5MFJB6SS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @sqzr,
Thank you for posting to the PayPal Community.
Your sandbox account is setup for Reference Transactions.
In order to process Reference Transactions there are a few API Calls that you will need to run. First a SetExpressCheckout API call. Next a CreateBillingAgreement API call, and lastly the DoReferenceTransaction API Call. If you skip any of the steps, you will not be able to process a Reference Transaction. The buyer must have an active billing agreement for you to be able to process reference transactions.
Here is some documentation on Reference Transactions:
First you need to run a SetExpressCheckout API request
https://developer.paypal.com/api/nvp-soap/set-express-checkout-nvp/
You need to include L_BILLINGTYPEn with a value of MerchantInitiatedBilling
So that PayPal can creates a billing agreement for each transaction associated with your buyer. You must specify version 54.0 or higher to use this option.
After the buyer agrees to the Merchant Initiated Billing, you need to send a Create Billing Agreement API Call with the token you obtained in the Set Express Checkout API Call.
https://developer.paypal.com/api/nvp-soap/create-billing-agreement-nvp/
Once you are ready to perform a Reference Transaction, you need to use the Billing Agreement id that was created when you ran the create-billing-agreement api call. The billing agreement id will look something similar to this BA-XXXX
https://developer.paypal.com/api/nvp-soap/do-reference-transaction-nvp/
If interested there is also a version that can be used with Rest API:
https://developer.paypal.com/limited-release/reference-transactions/
Thank you,
Jennifer
MTS
PayPal

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Unable to test successful payments using sandbox personal accounts in NVP/SOAP APIs
- Getting an error when calling API endpoint for Create Billing Agreement Token V1 in Sandbox Environment
- This merchant account is not permitted to create Merchant Initiated Billing Agreement in PayPal Payments Standard
- Getting METHOD_NOT_SUPPORTED response to billing agreement token request in REST APIs
- Logging in redirects our customers to an error page instead of billing agreement approval in REST APIs