Sandbox - NVP SOAP API (Classic) - Billing Agreement ID

sqzr
Contributor
Contributor

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

Login to Me Too
1 REPLY 1

MTS_Jennifer
Moderator
Moderator

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

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.