BN Code Samples

 

Get ready for a new PayPal Partner Portal experience.
Watch for the launch email with details.

Integration

 

BN Code Samples

BN codes (or Build Notation codes) are provided to Partners for inclusion into their product integration as a passed parameter during a transaction. BN codes provide tracking on all transactions originating or associated with a particular Partner.

Do you need a BN code?

New partners are provided with their unique BN code.  If you did not receive it or need it resent, please contact partnerprogram@paypal.com.

The page consolidates the BN code integration examples for different products for easy reference.

Express Checkout

NVP example

Include "BUTTONSOURCE" in the DoExpressCheckoutPayment API call between the Form tags, as shown in the following example:


METHOD=DoExpressCheckoutPayment&
TOKEN=EC-6E917223CK867610S&
SUBJECT=ed%40jubiprints.com&
PAYERID=CXXVAT4MS937Q&
BUTTONSOURCE=Your BN Code&
PAYMENTREQUEST_0_ITEMAMT=31.55&
PAYMENTREQUEST_0_SHIPPINGAMT=6.95&
PAYMENTREQUEST_0_HANDLINGAMT=0&
PAYMENTREQUEST_0_TAXAMT=0& 
PAYMENTACTION=Sale&

SOAP API example

Add the ButtonSource element to your DoExpressCheckoutRequestDetails object, and set its value to 'Your BN Code'. For example:


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:ns2="urn:ebay:api:PayPalAPI">
     <SOAP-ENV:Header>
           <ns2:RequesterCredentials>
                <ns1:Credentials>
                     <ns1:Username>****</ns1:Username>
                     <ns1:Password>****</ns1:Password>
                     <ns1:Signature>****</ns1:Signature>
                </ns1:Credentials>
           </ns2:RequesterCredentials>
     </SOAP-ENV:Header>
     <SOAP-ENV:Body>
           <ns2:DoExpressCheckoutPaymentReq>
                <ns2:DoExpressCheckoutPaymentRequest>
                     <ns1:Version>89.0</ns1:Version>
                     <ns1:DoExpressCheckoutPaymentRequestDetails>
                           <ns1:Token>EC-33229310ET288493C</ns1:Token>
                          <ns1:PayerID>E7AN983DT7HKN</ns1:PayerID>
                           <ns1:PaymentDetails>
                                <ns1:OrderTotal currencyID="USD">24.99</ns1:OrderTotal>
                                <ns1:PaymentAction>Sale</ns1:PaymentAction>
                           </ns1:PaymentDetails>
                           <ns1:ButtonSource> Your BN Code </ns1:ButtonSource>
                     </ns1:DoExpressCheckoutPaymentRequestDetails>
                </ns2:DoExpressCheckoutPaymentRequest>
           </ns2:DoExpressCheckoutPaymentReq>
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Java example

Below is a sample of the DoExpressCheckoutPayment call from the SDK

The ButtonSource parameter must be in the PaymentDetails element.


DoExpressCheckoutPaymentResponseType ppresponse=new DoExpressCheckoutPaymentResponseType(); 
// Create the request details object.
DoExpressCheckoutPaymentRequestDetailsType paymentDetailsRequestType = new DoExpressCheckoutPaymentRequestDetailsType();
//pass the token value by actual value returned in the SetExpressCheckout
paymentDetailsRequestType.setToken(token);
paymentDetailsRequestType.setPayerID(payerID);
paymentDetailsRequestType.setPaymentAction(paymentAction); 
PaymentDetailsType paymentDetails = new PaymentDetailsType();
BasicAmountType orderTotal = new BasicAmountType();
orderTotal.set_value(paymentAmount);
orderTotal.setCurrencyID(currencyCodeType);
paymentDetails.setOrderTotal(orderTotal);
paymentDetails.setButtonSource(Your BN Code)
paymentDetailsRequestType.setPaymentDetails(paymentDetails);
pprequest.setDoExpressCheckoutPaymentRequestDetails(paymentDetailsRequestType);

PayPal Payments Standard (Website Payments Standard)

To include your BN code in PayPal Payments Standard, the parameter is bn.

NVP Sample

USER=user_api_username_api1.paypal.com&
PWD=1234567890&
SIGNATURE=Abg0gYcQyxQvnf2HDJkKtA-p6pqhA1k-KTYE0Gcy1diujFio4io5Vqjg&
VERSION=93.0&
METHOD=BMCreateButton&
BUTTONCODE=HOSTED&BUTTONTYPE=CART&
BUTTONSUBTYPE=PRODUCTS&
BUTTONCOUNTRY=US&
bn=Your BN Code&
L_BUTTONVAR1=item_name=shoehorn&
L_BUTTONVAR2=amount=1234.56&L_BUTTONVAR3=tax=12&
L_BUTTONVAR4=item_number=987654

Java Sample

BMCreateButtonRequestType requestType = new BMCreateButtonRequestType();
 requestType.setButtonCode(ButtonCodeType.HOSTED);
 requestType.setButtonType(ButtonTypeType.CART);
 requestType.setButtonSubType(ButtonSubTypeType.PRODUCTS);
 requestType.setButtonImage(ButtonImageType.SML);
 requestType.setButtonCountry(CountryCodeType.US);
 requestType.setButtonLanguage("en");
 String[] buttonVar = {"business=" + cartVO.getBusiness(),
     "item_name=" + cartVO.getItemName(),
     "shipping=1.00",
     "currency_code=" + cartVO.getCurrencyCode(),
     "bn=" + cartVO.getBnCode(),
     "tax_rate=1.000",
     "no_shipping=2",
     "no_note=0"};
   
 requestType.setButtonVar(buttonVar);

HTML Sample


<form action=https://www.paypal.com/cgi-bin/webscr method="post">
	<input name="cmd" value="_cart " type="hidden">
	<input name="upload" value="1" type="hidden ">
	<input name="business" value="merchants@samplemerchant.com" type=" hidden">
	<input name="item_name_1" value="Item Name 1" type=" hidden">
	<input name="amount_1" value="1.00" type=" hidden">
	<input name="item_number_1" value="12345" type=" hidden">
	<input name="shipping_1" value="0.50" type=" hidden">
	<input name="paymentaction" value="sale" type=" hidden">
	<input name="bn" value="Your BN Code" type=" hidden">
	<input value="Checkout" type=" submit">
</form>

PayPal Payments Pro

NVP example

Include "BUTTONSOURCE" in both the DoExpressCheckoutPayment and DoDirectPayment API calls between the Form tags.

(See section 2 for DoExpressCheckoutPayment API examples)


[requiredSecurityParameters]&METHOD=DoDirectPayment&VERSION=64.0&
PAYMENTACTION=Sale&IPADDRESS=172.0.0.1&
CREDITCARDTYPE=Mastercard&
ACCT=5105105105115000&EXPDATE=123112&CVV2=123&
FIRSTNAME=John&LASTNAME=Doe&
AMT=0.01&CURRENCYCODE=USD&BUTTONSOURCE=Your BN Code

SOAP example

If you are using the PayPal SOAP API, add the ButtonSource element to your PaymentDetails object, and set its value to Your BN Code. For example:


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:ns2="urn:ebay:api:PayPalAPI">
     <SOAP-ENV:Header>
           <ns2:RequesterCredentials>
                <ns1:Credentials>
                     <ns1:Username>****</ns1:Username>
                     <ns1:Password>****</ns1:Password>
                     <ns1:Signature>****</ns1:Signature>
                </ns1:Credentials>
           </ns2:RequesterCredentials>
     </SOAP-ENV:Header>
     <SOAP-ENV:Body>
           <ns2:DoDirectPaymentReq>
                <ns2:DoDirectPaymentRequest>
                     <ns1:Version>92.0</ns1:Version>
                     <ns1:DoDirectPaymentRequestDetails>
                           <ns1:PaymentAction>Sale</ns1:PaymentAction>
                           <ns1:PaymentDetails>
                                <ns1:OrderTotal currencyID="USD">24.99</ns1:OrderTotal>
                                <ns1:ButtonSource> Your BN Code </ns1:ButtonSource>
                           </ns1:PaymentDetails>
                           <ns1:CreditCard>
                                <ns1:CreditCardType>Visa</ns1:CreditCardType>
                                <ns1:CreditCardNumber>4474********3398</ns1:CreditCardNumber>
                                <ns1:ExpMonth>12</ns1:ExpMonth>
                                <ns1:ExpYear>2014</ns1:ExpYear>
                           </ns1:CreditCard>
                           <ns1:IPAddress></ns1:IPAddress>
                     </ns1:DoDirectPaymentRequestDetails>
                </ns2:DoDirectPaymentRequest>
           </ns2:DoDirectPaymentReq>
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Adaptive Payments

For recording BN code in AP, parameter 'referrerCode' in senderOptions object should be used. The APIs in the following sequence has to be executed.


Pay(with CREATE option) 
SetPaymentOptions (senderOptions.referrerCode) 
ExecutePayment to record the BN Code.

Sample SetPaymentOpions request


curl -s --insecure 
-H "X-PAYPAL-SECURITY-USERID:kbadri_1315422529_biz_api1.paypal.com"
 -H "X-PAYPAL-SECURITY-PASSWORD:2345674" 
-H "X-PAYPAL-SECURITY-SIGNATURE:Ahydjkce0tBwP9OTaQreZf0Enzd4AtG1hNpK9oGFtb8xmhcTKCGMMOAK" 
-H "X-PAYPAL-REQUEST-DATA-FORMAT:NV" 
-H "X-PAYPAL-RESPONSE-DATA-FORMAT:NV" 
-H "X-PAYPAL-APPLICATION-ID:APP-80W284485P519543T" https://svcs.sandbox.paypal.com/AdaptivePayments/SetPaymentOptions -d "requestEnvelope.errorLanguage=en_US&
receiverOptions[0].receiver.email=svedul_1303417161_per@paypal.com&
receiverOptions[0].invoiceData.item[0].name=ITEM1&receiverOptions[0].invoiceData.item[0].price=50.0&receiverOptions[0].invoiceData.item[0].itemCount=2&receiverOptions[0].invoiceData.item[0].itemPrice=25.0&receiverOptions[0].invoiceData.totalTax=25.0&receiverOptions[0].invoiceData.totalShipping=25.0&payKey=AP-5S347540GM260784X&senderOptions.referrerCode=Your_BN_Code"