Secure Customer Data Fields

Secure Customer Data Fields let you capture and tokenize sensitive customer data without storing it on your server. Each field works like a standard HTML input element, so you have full control over how your data collection form looks and behaves.

When you receive the tokenized data, you can send the token in a New Application API request to submit a new merchant application.

Prerequisites

Before you begin, determine which BlueSnap environment you want to use. BlueSnap maintains separate resources for sandbox and production so you can test your integration before submitting production merchant applications.

Each environment has a dedicated domain. When implementing Secure Customer Data Fields, specify the domain in two places:

  • The HTML <script> element that loads the BlueSnap Web SDK.
  • The server-to-server request that creates the session token.

Replace <bluesnap-domain> wherever it appears with one of the following:

sandpay.bluesnap.com
pay.bluesnap.com

For example, the <script> element to include the Web SDK sandbox environment should use:

<script type="text/javascript" src="https://sandpay.bluesnap.com/web-sdk/5/bluesnap.js"></script>

Implement Secure Customer Data Fields

The following steps describe how to add Secure Customer Data Fields to your merchant application form.

Step 1: Get a Session Token

Each merchant application requires a unique session token. BlueSnap uses this token to associate the merchant’s secure field data with the application submission.

To get a session token, send a server-to-server POST request to the following endpoint:

https://<bluesnap-domain>/services/2/payment-fields-tokens

The token is returned in the Location response header. For example:

HTTP/1.1 201 Created
Location: https://sandpay.bluesnap.com/services/2/payment-fields-tokens/5ad59e4389abba704ee2d61580d1d5cc1ba0ccf114470d404f771a198d99891b_

Use the token value from the end of the Location header when you initialize the form and when you submit the merchant application.

📘

Token expiration

The token expires after 60 minutes. You can get a new token from BlueSnap when the token expires. For details, refer to Update an Expired Token.

Step 2: Include the BlueSnap Web SDK

Add the BlueSnap Web SDK to the page that contains your merchant application form.

<script type="text/javascript" src="https://<bluesnap-domain>/web-sdk/5/bluesnap.js"></script>

Step 3: Add Secure Customer Data Fields

For each data element that you need to collect, add an input field with the corresponding data-bluesnap attribute. For example, add the following to collect the business name:

<input data-bluesnap="businessName" />

BlueSnap provides a Secure Customer Data Field for each data element required for supported countries and regions. To determine which fields are required for a merchant’s country or region, refer to the applicable section in the New Application API reference.

For a complete list of supported data-bluesnap attributes, refer to Input field reference.

<form id="merchantApplicationForm">
  <label for="businessName">Business name</label>
  <input
    id="businessName"
    name="businessName"
    data-bluesnap="businessName"
    placeholder="Business name"
  />

  <label for="businessLegalName">Business legal name</label>
  <input
    id="businessLegalName"
    name="businessLegalName"
    data-bluesnap="businessLegalName"
    placeholder="Business legal name"
  />

  <!-- Add additional required fields for the merchant's country or region. -->

  <button id="submitButton" type="button">Submit application</button>
</form>
👍

Customize your input fields

You can add standard HTML attributes to Secure Customer Data Field input elements. For example, use class to apply CSS styles or placeholder to show expected values.

Step 4: Initialize the Form

After the DOM and BlueSnap Web SDK are loaded, call bluesnap.partnerSecuredCaptureSetup.

document.addEventListener("DOMContentLoaded", function () {
  bluesnap.partnerSecuredCaptureSetup("<token>", function (sdkResponse) {
    if (sdkResponse.code === 1) {
      // Secure field data was submitted successfully.
      // Continue by submitting the merchant application to your server.
    } else {
      const { errors, warnings } = sdkResponse.info || {};
      console.log("Errors:", errors);
      console.log("Warnings:", warnings);
    }
  });
});

bluesnap.partnerSecuredCaptureSetup accepts two arguments:

ArgumentDescription
tokenSession token returned by BlueSnap.
callbackFunction that receives the sdkResponse object after secure field data is submitted to BlueSnap.

The callback should check whether the submission was successful and handle any errors or warnings. For more information, refer to sdkResponse Object.

Step 5: Submit the Secure Field Data

When the merchant submits the form, call bluesnap.partnerSecuredCaptureSubmitData. This function submits the secure field values directly to BlueSnap. BlueSnap stores the data and binds it to the session token.

document
  .getElementById("submitButton")
  .addEventListener("click", function () {
    bluesnap.partnerSecuredCaptureSubmitData();
  });

After the secure field data is submitted, BlueSnap passes the result to the callback function that you provided in bluesnap.partnerSecuredCaptureSetup.

📘

Field values are cleared after successful submission

After sdkResponse.code is 1, the values in the secure input fields are deleted to maintain the merchant’s confidentiality.

Step 6: Submit the Merchant Application

After the secure field data is submitted successfully, send the session token as pfToken in the New Application API request:

{
  "pfToken": "<token>",
  "businessInfo": {
    "country": "US"
  }
}
🚧

Secure field submission is not final application validation

A successful secure field submission means BlueSnap stored the secure field values and associated them with the token. The New Application API still validates required fields, formats, country-specific requirements, and other application data.

Update an Expired Token

The session token expires after 60 minutes. To let BlueSnap handle token expiration automatically, define a function that obtains a new token from your server. Then, call bluesnap.setTokenProvider before calling bluesnap.partnerSecuredCaptureSetup.

BlueSnap calls your token provider function when an expired token is detected.

bluesnap.setTokenProvider((callback) => {
  fetch("/path/to/token")
    .then((response) => response.json())
    .then((data) => {
      callback(data.token);
    })
    .catch((error) => {
      console.log(error);
      callback();
    });
});

Your token endpoint should request a new token from BlueSnap and return it to the browser.

sdkResponse Object

The sdkReponse object contains the results from your data submission to BlueSnap.

{
  status: 'Success',
  code: 1
}
{
  status: 'Invalid Data',
  code: 15,
  "info": {
    "errors": ["Some error"],
    "warnings": [
      "Parameter \"bankAccountType\" with the value of \"savings123\" is invalid"
    ]
  }
}
{
  status: 'Server Error',
  code: 14040,
  info: {
    errors: ['Token is expired'],
  }
}

Properties

The following table describes its properties:

PropertyTypeDescription
statusstring

Status of the data submission.

Possible values:
  • Success — The data submission was successful. Continue by submitting the merchant application to your server.
  • Invalid Data — One or more input values may be missing or invalid. Check sdkResponse.info.warnings.
  • Server Error — BlueSnap could not process the secure field submission. Check sdkResponse.info.errors.
codeinteger

Status code of the data submission.

Possible values:
  • 1sdkResponse.status is Success.

    Note: When the response status is Success, it is still possible to have errors when you submit the application. There is no validation on parameter values at this stage.

  • 15 — When sdkResponse.status is Invalid Data. The warning does not prevent the process from continuing, but you should review the warning before submitting the application.

  • 14040 — When sdkResponse.status is Server Error. The token is expired and needs to be updated.

  • All other codes indicate a general BlueSnap server error. Check sdkResponse.info.errors.

infoobject

Present if any errors or warnings occurred.

Contains:

Errors

When sdkResponse.status is 'Server Error', error details are available in sdkResponse.info.errors. Errors prevent you from continuing the secure field submission process.

ErrorDescriptionSolution
Token is expiredThe token is expired.Reload the page or implement bluesnap.setTokenProvider.
General server errors, including Unauthorized or Server UnavailableThe error message in sdkResponse.info.errors provides more details.Resolve the issue described in the error message or contact BlueSnap Support.

Warnings

When sdkResponse.status is 'Invalid Data', warning details are available in sdkResponse.info.warnings. Warnings identify input conditions you may need to address. Unlike errors, warnings do not always prevent the process from continuing.

Warning messageDescriptionSolution
Data BlueSnap Input <given_key> is missingBlueSnap could not find an input value with the attribute data-bluesnap=<given_key>Confirm that the input was added to the page, or display a message for the merchant to enter a value.
Parameter "<given_key>" with value of "<value>" is invalidOne or more input values is invalid.Display a message for the merchant to correct the value.

Input Field Reference

These sections list the supported Secure Customer Data Fields and their associated HTML data-bluesnap attributes. For details about which secure input fields you need for a merchant, see the New Application API request content for the applicable country or region.

🚧

Important

The data-bluesnap attribute values must be entered exactly as they appear in these tables.

Business Information

DataInput Field with Data Attribute
Business name<input data-bluesnap="businessName"/>
Business legal name<input data-bluesnap="businessLegalName"/>
Business product and service description<input data-bluesnap="businessProductAndServiceDesc"/>
Business phone<input data-bluesnap="businessPhone"/>
Business email<input data-bluesnap="businessEmail"/>
Business website<input data-bluesnap="businessWebsite"/>
Business additional website<input data-bluesnap="businessAdditionalWebsite[n]"/>
Business type<input data-bluesnap="businessType"/>
Business category<input data-bluesnap="businessCategory"/>
Business tax ID<input data-bluesnap="businessTaxId"/>
Business address<input data-bluesnap="businessAddress"/>
Business city<input data-bluesnap="businessCity"/>
Business state<input data-bluesnap="businessState"/>
Business suburb<input data-bluesnap="businessSuburb"/>
Business zip<input data-bluesnap="businessZip"/>
Business country<input data-bluesnap="businessCountry"/>
Business account username<input data-bluesnap="businessAccountUsername"/>
Business sales volume<input data-bluesnap="businessSalesVolume"/>
Business registration number<input data-bluesnap="businessRegistrationNumber"/>
Business trading name<input data-bluesnap="businessTradingName"/>
Business ACN or ABN<input data-bluesnap="businessAcnOrAbn"/>
Business Average Transaction Amount<input data-bluesnap="businessAverageTransactionAmount"/>
Business Highest Transaction Amount<input data-bluesnap=" businessHighestTransactionAmount"/>
Business Risk Monitoring<input data-bluesnap=" businessRiskMonitoring"/>
Business Risk Management<input data-bluesnap=" businessRiskPayment"/>
Business Risk by Commission<input data-bluesnap=" businessRiskByCommission"/>

Bank Information

DataInput Field with Data Attribute
Bank name<input data-bluesnap="bankName"/>
Bank branch code<input data-bluesnap="bankBranchCode"/>
Bank code<input data-bluesnap="bankCode"/>
Bank routing number<input data-bluesnap="bankRoutingNumber"/>
Bank account number<input data-bluesnap="bankAccountNumber"/>
Bank BSB<input data-bluesnap="bankBsb"/>
Bank transit number<input data-bluesnap="bankTransitNumber"/>
Bank institution number<input data-bluesnap="bankInstitutionNumber"/>
Bank sort order<input data-bluesnap="bankSortOrder"/>
Bank BIC<input data-bluesnap="bankBic"/>
Bank IBAN<input data-bluesnap="bankIban"/>
Bank SWIFT or BIC code<input data-bluesnap="bankSwiftOrBICCode"/>
Bank account number or IBAN<input data-bluesnap="bankAccountNumberOrIBAN"/>
Bank account type<input data-bluesnap="bankAccountType"/>
Bank city<input data-bluesnap="bankCity"/>
Bank state<input data-bluesnap="bankState"/>
Bank province<input data-bluesnap="bankProvince"/>
Bank country<input data-bluesnap="bankCountry"/>
Bank payout currency<input data-bluesnap="bankPayoutCurrency"/>
Minimal payout amount<input data-bluesnap="bankMinimalPayoutAmount"/>
Refund reserve<input data-bluesnap="bankRefundReserve"/>

Ownership Information

You can collect data for up to four business owners. In the data attribute, replace [n] with an integer 1 through 4:

Merchant DataInput Field with Data Attribute
Business owner first name<input data-bluesnap="owner[n]FirstName"/>
Business owner last name<input data-bluesnap="owner[n]LastName"/>
Business owner date of birth<input data-bluesnap="owner[n]DateOfBirth"/>
Business owner government ID number<input data-bluesnap="owner[n]GovID"/>
Business owner phone<input data-bluesnap="owner[n]Phone"/>
Owner percent<input data-bluesnap=" owner[n]Percent"/>
Business owner address<input data-bluesnap="owner[n]Address"/>
Business owner city<input data-bluesnap="owner[n]City"/>
Business owner state<input data-bluesnap="owner[n]State"/>
Business owner zip<input data-bluesnap="owner[n]Zip"/>
Business owner country<input data-bluesnap="owner[n]Country"/>

Company Representative Information

Merchant DataInput Field with Data Attribute
Company representative first name<input data-bluesnap="companyRep[n]FirstName"/>
Company representative last name<input data-bluesnap="companyRep[n]LastName"/>
Company representative date of birth<input data-bluesnap="companyRep[n]DateOfBirth"/>
Company representative government ID<input data-bluesnap="companyRep[n]GovID"/>
Company representative phone<input data-bluesnap="companyRep[n]Phone"/>
Company representative address<input data-bluesnap="companyRep[n]Address"/>
Company representative city<input data-bluesnap="companyRep[n]City"/>
Company representative state<input data-bluesnap="companyRep[n]State"/>
Company representative zip<input data-bluesnap="companyRep[n]Zip"/>
Company representative country<input data-bluesnap="companyRep[n]Country"/>

Additional Information

Merchant DataInput Field with Data Attribute
Service agreement sign date<input data-bluesnap="serviceAgreementDate"/>
Pricing agreement sign date<input data-bluesnap="pricingAgreementDate"/>
Merchant IP address<input data-bluesnap="merchantIp"/>
Default IPN URL<input data-bluesnap="defaultIPN"/>
Metadata key<input data-bluesnap="metadata[n]Key"/>
Metadata value<input data-bluesnap="metadata[n]Value"/>