Set

Summary

The Set function allows for dynamic updates to the data transmitted to the Open Elements at any point prior to the submission of the payment for processing. This capability is particularly beneficial when data has been previously stored or collected on earlier pages, or when modifications are required to the initial data configuration in the Open Elements Initialization.

Usage

Initialization

Before calling the set function you need to make sure the Open Elements have been initialized as documented here Initialize.

Example

let oe = new openElements('{API Login ID}', {
	orderId: 'IN-240124',
	total: 1.00
});

Setting Attributes

Once the Open Elements have been initialized you can use the set function to change attributes at any time.

Email

oe.setEmail('[email protected]');

Phone

oe.setPhone('9495551212');

Country Code

oe.setCountryCode('US');

Shipping same as Billing

oe.setSameShippingToBillingAddress(true);

Total

oe.setTotal(1.99);

Currency

oe.setCurrency('USD');

Order ID

oe.setOrderId('jk4932');

Is Recurring

oe.setIsRecurring(false);

Shipping

oe.setShipping.address1('123 Fake St');
oe.setShipping.address2('Suite 2');
oe.setShipping.city('Springfield');
oe.setShipping.stateCode('IL');
oe.setShipping.postalCode('48589');
oe.setShipping.countryCode('US');
oe.setShipping.firstName('Jane');
oe.setShipping.lastName('Doe');

Billing

oe.setBilling.address1('123 Fake St');
oe.setBilling.address2('Suite 2');
oe.setBilling.city('Springfield');
oe.setBilling.stateCode('IL');
oe.setBilling.postalCode('48589');
oe.setBilling.countryCode('US');
oe.setBilling.firstName('Jane');
oe.setBilling.lastName('Doe')