Integrating PromisePay.js

The PromisePay.js SDK provides front-end features for your platform and allows your front end (a user’s browser or web app) to talk to Assembly directly. The package is primarily designed to assist in PCI compliance, allowing for credit card and bank account details to be captured securely to help with PCI compliance. It also provides methods for capturing DeviceID and the user’s IP address.

If you are opting in our fraud protection services, then you are required to integrate PromisePay.js into your platform.

Including the SDK

Add the below code within the <head></head> tags of your page. This will instantiate an Assembly class. Include only the library for the environment you’re working with.

// Include this library for pre-live

<script src="https://js.prelive.promisepay.com/PromisePay.js " type="text/javascript"></script>

// Include this library for production

<script src="https://js.promisepay.com/PromisePay.js " type="text/javascript"></script>

Uses of PromisePay.js

Generating a device ID

There is a single method that needs to be called to generate a Device ID which represents the device the user is using. The method will return a string value with the Device ID, therefore you will need to set up methods for the data to be passed back to.

These methods should send the data back to your platform’s backend. It will be required when making a payment.

// Create your callback methods

success = function(data) {

   console.log(data);

}

fail = function(data) {

   console.log(data);

}

// Will return the Device ID as a string.

promisepay.captureDeviceId(success);

Capturing an IP address

There is a single method that needs to be called to generate an IP address which represents the IP of the device the user is using. The method will return a string value with the IP Address, therefore you will need to set up methods for the data to be passed back to.

These methods should send the data back to your platform’s backend. It will be required when making a payment:

// Create your callback methods

success = function(data) {

console.log(data);

}

fail = function(data) {

console.log(data);

}

// Will return the IP Address as a string.

promisepay.getIPAddress(success);

Capturing Credit Card and Bank Account Details

Capturing credit card and bank account details through a front-end interface will result in data being securely sent to Assembly with minimal impact to your PCI compliance. There are multiple methods which can be used to capture credit card and bank account details.

Please see Capturing a Credit Card and Capturing a Bank Account for step-by-step instructions on capturing account details through generating a related token, or using a custom HTML form.