Initializing the Pro-Life Payments.js SDK
Below are the script tags that you need to add to your checkout page to load and initialize our SDK. These will load Pro-Life Payments.js directly from our servers. These script tags should be the last scripts to be loaded on your site.
<script>
let plp = null;
// This function will run as soon as the script is loaded
function loadPaymentSdk() {
//Initialize the SDK (For direct merchants ONLY)
plp = new ProLifePayments('pk_Add_Your_Public_Key_Here');
//Initialize the SDK (For ISVs & Partners that process payments on behalf of their merchants/sub-merchants)
//plp = new ProLifePayments('pk_Add_Your_Public_Key_Here', { onBehalfOf: "acm_Add_a_Merchant_Account_ID_Here" })
}
</script>
<script src="https://js-dev.prolifepayments.com/sdk/js/payments/v1.0/sdk.js" onload="loadPaymentSdk()"></script>Initializing Pro-Life Payments.js
To create an instance of the Pro-Life Payments object, which serves as the entry point to the rest of the Pro-Life Payments.js library you must call the class constructor with the word new in front of it and pass the required parameters.
Constructor
new ProLifePayments(publicKey, options?)Constructor Parameters
| Parameter | Required/Optional | Type | Description |
|---|---|---|---|
| publicKey | required | string | Your public key (Can be retrieved from the portal) |
| options | optional | Options object | Initialization Options (Only required for ISVs and Partners that process payments on behalf of their merchants/sub-merchants) |
Options object
| Parameter | Required/Optional | Type | Description |
|---|---|---|---|
| onBehalfOf | required | string | This parameter is required for Partners and ISVs Only. You must specify the Account ID (acm_***) for the merchant that you will be processing payments on behalf of. |
Initialization Examples
When initializing Pro-Life Payments.js as a Merchant to run payments for your own Merchant account
var plp = new ProLifePayments('pk_your_test_public_key);When initializing Pro-Life Payments.js as a Partner or ISV to run payments on behalf of one of your merchant/submerchants include the onBehalfOf parameter with the account's ID.
var plp = new ProLifePayments('pk_your_test_public_key', { onBehalfOf: "acm_your_other_account_ID" });Updated 2 months ago
