Got questions? Leave your message here or Schedule a quick call with our manager now

How to Use Plugin Builder?

The Plugin Builder allows you to build the Bridge Connector plugin, which is used to connect the store to API2Cart, for different shopping platforms. The following platforms are currently supported:

  • Magento 2
  • Opencart 2.x - 4.x
  • PrestaShop
  • Shopware 6
  • WooCommerce

If the “Plugin builder” feature is available in the account plan, the plugin can be customized to your needs, for example, you can specify the plugin's name, company, description, and logo. Also, you can enable or disable encryption on the bridge, configure the callback URL, etc. When this feature is unavailable in the plan, the values for the plugin are set by default.

Also, the possibility of asymmetric data encryption has been added to the Plugin Builder. Data is encrypted using the OAEP (Optimal Asymmetric Encryption Padding) protocol, which provides a reliable level of security and resistance to attacks. More details.

Callback URL and Public Key allow you to generate a plugin. After installing it and clicking the “Connect” button, a webhook will be sent to the URL that was specified in the Callback URL field with encrypted store credentials that can be used when adding it to APICart. Namely: store_url, store_key, store_root, bridge_url. Data is encrypted with an RSA key. You can insert your own public key or generate a pair of 2048-bit keys.

The data sent to the callback is encrypted according to the following principle:

  • Encoding the data array into a JSON string
  • Division of the received string into parts of one length (depending on the length of the generated key)
  • Encoding the parts with the public key
  • Combining the encoded parts into one string and converting it to base64 format
  • Sending the base64-encoded string to the callback

The callback will receive a webhook with encrypted data in the "data" field.

The x-webhook-cart-id and x-webhook-timestamp headers are also available.

To decrypt the data, you need to perform actions with the received data in the reverse direction:

  • Decode from base64
  • Division of the string into equal parts (depending on the key length)
  • Decrypt the received parts using the private key
  • Combine the obtained decrypted parts into a single JSON string

Here's an example of PHP code:

As a result, you will receive data that can be used in the account.cart.add method to add a store.

Some fields in the Pplugin Builder are validated, and an error will be displayed if incorrect data is entered. Also, next to each field is a hint with a brief description of what this field is for.

After successfully building the plugin, the downloaded archive with the plugin can be installed on the page of the selected platform.

Posted in: General Service Questions