# Ecommerce plugin general functions

Source: https://developer.avalara.com/products/ecm/integration-guides/document-management/hgd7389643201451/

Guide: Exemption Certificate Management (ECM)

# Ecommerce plugin general functions

Learn about the general functions available in the ecommerce plugin and their configurations.

Function

Description

`submit_to_stack`

Sends a new document to be validated in the ECM. Choose one of the following options:

-   False (default): New certificates are automatically valid. This allows your customers to make exempt purchases right away.

-   True: New certificates are submitted to your validation queue in ECM. The customer isn’t treated as exempt until you validate the document.

Note

If you use `submit_to_stack: true`, use the `onInit` callback function to display a message. This lets the user know they may not be able to make a tax-exempt purchase immediately, as you must manually validate the certificate.

`preview`

Allows the user to see a preview of their new certificate before signing and submitting the certificate. Choose one of the following options:

-   False (default): The user sees a blank copy of the exemption certificate, but doesn’t see a preview of the certificate with their information.

-   True: The user sees a preview of the certificate populated with the information that they’ve entered.

Note

The preview is a low resolution GIF. If you want to provide the user with the option to download a high-quality copy of the certificate, use the `show_files` function.

`upload_only`

Disables the ability to complete documents by submitting information to form fields. Customers can only upload prefilled documents. Choose one of the following options:

-   False (default): The user is guided to enter their exemption certificate information, and the application generates a new copy of the certificate.

-   True: The user must upload a scanned copy of their exemption certificate in one of the following file formats: PDF, JPEG, TIFF, PNG.

Note

If you use `upload_only: true`, the certificate is sent to your certificate validation queue and must be manually validated.

`fill_only`

Allows you to disable the upload of prefilled documents, so that users must generate a new copy of the certificate by entering their information. Choose one of the following options:

-   False (default): The user can either upload a scanned copy of their certificate or generate a new copy of the certificate by entering their exemption certificate information.

-   True: The user is guided to enter their exemption certificate information, and ECM generates a new copy of the certificate. The user isn’t able to upload a scanned copy of their certificate, unless the state requires them to upload a copy of their state-issued license or a similar document.

`show_files`

Displays a download link after document submission. Avalara recommends setting this to `show_files: true`. Choose one of the following options:

-   False (default): The user isn’t given the option to download a PDF copy of the exemption certificate.

-   True: The user is given the option to download a PDF copy of the exemption certificate.

`edit_purchaser`

Allows customers to edit their information on return visits. Choose one of the following options:

-   False (default): If you already have the customer added in your ECM account, the user isn’t allowed to update their name, phone number, or address.

-   True: Allows the user to update their name, phone number, and address.

`setCustomerData(customer)`

Use this option to send customer information for new customers. This function must follow the standard convention, as follows:

```
// create customer
customer = new Object();
customer.name = 'TEST NAME';
customer.address1 = '1300 EAST CENTRAL';
customer.city = 'San Francisco';
customer.state = 'CA';
customer.country = 'US';
customer.zip = '89890';
customer.phone = '555-555-5555';
customer.fax = '555-555-5555';
GenCert.setCustomerData(customer);
// setShipZone if you haven't specified it in the GenCert parameters.
GenCert.setShipZone('California');
```

`setShipZone(zone)`

Sets the zone to which the transaction is shipping and/or where the certificate would apply. This isn’t the customer's state, per billing records, but rather the shipping state where goods will be delivered.

The parameter state should be a valid U.S. or Canadian state/province specified in a proper case, for example: `('California')`. Lower case or upper case names aren’t accepted. The ship zone must be provided for the system to create a proper form.

`Show()`

Use this option to decide when to show the exemption certificate completion form in your ecommerce platform.

`hide()`

Use this option to hide the exemption certificate completion form once the user has completed the process. This option hides the form in the parent container.