CS-Cart

Before you begin:

Step 1: Create a payment source

To add a new payment source in the Viva Wallet banking app:

  1. Click on Sales in the left navigation:

    Sales submenu
  2. Click on Online payments in the Sales submenu:

    Online payments submenu
  3. Click on Websites / apps in the Online payments submenu:

    Online payments submenu
  4. Click on the Add Website/App button on the right.
    The New Payment Source dialog box is displayed:

    New Payment Source dialog box
  5. Complete the fields as follows:

    • Code – the four-digit number in the top-left of the dialog box is the ‘Source Code’. Make a note of it for use in your plugin.
    • Source Name – give your payment source a source name so you can recognise it in your reports.
    • Linked Wallet – link the payment source to the required wallet.
    • Protocol – if your e-commerce platform uses SSL on the checkout, select https, otherwise use http.
    • Domain Name – enter the domain name to be associated (without the protocol. i.e. use [(www.)yourdomain.com], not http://[yourdomain].com). If the site uses www, it must be specified and visa versa.
    • Integration method – leave this with redirection selected.
    • Company Logo - a PNG of your company logo to be displayed on the Viva Wallet payment page.
    • Success URL – enter [success_url] as described in the plugin instructions.
    • Failure URL – enter [failure_url] as described in the plugin instructions.
  6. Click on the Create button to finish creating the payment source.

Once the payment source moves from a status of ‘Pending’ to ‘Active’ in the Website/Apps list, it’s ready to use. This should take no longer than 24 hours.

Step 2: Integrate with the e-commerce store

1) Unzip the archive (API-master.zip) you downloaded earlier.

2) Open the directory (API-master⁩/Plugins⁩/cscart/cscart-vivawallet) containing the source files.

3) Upload the files from the package.

4) Backup your database and execute the following SQL statements (with phpmyadmin for example):

INSERT INTO `cscart_payment_processors` (`processor`, `processor_script`, `processor_template`, `admin_template`, `callback`, `type`) VALUES
('Viva Payments', 'vivawallet.php', 'vivawallet.tpl', 'vivawallet.tpl', 'N', 'P');

INSERT INTO `cscart_language_values` (`lang_code` ,`name` ,`value`) VALUES
('EN', 'vivawallet_instalments', 'Instalments');

INSERT INTO `cscart_language_values` (`lang_code` ,`name` ,`value`) VALUES
('EN', 'vivawallet_no_instalments', 'No Instalments');

INSERT INTO `cscart_language_values` (`lang_code` ,`name` ,`value`) VALUES
('EN', 'vivawallet_instalments_step', 'Instalment steps');

INSERT INTO `cscart_language_values` (`lang_code` ,`name` ,`value`) VALUES
('EN', 'vivawallet_instalments_start', 'First instalment');

INSERT INTO `cscart_language_values` (`lang_code` ,`name` ,`value`) VALUES
('EN', 'vivawallet_transaction_fail', 'Transaction failed or has been cancelled.');

INSERT INTO `cscart_language_values` (`lang_code` ,`name` ,`value`) VALUES
('EN', 'text_vivawallet_notice', '<b>Note:</b> Please set the following information to payment source:<br />Success URL: <u>[success_url]</u><br /> Fail URL: <u>[failure_url]</u><br /><b>Optional:</b> Set the following information to the webhook URL:<br />Success URL: <u>[webhook_url]</u><br /><br />'),
('EL', 'text_vivawallet_notice', '<b>Note:</b> Please set the following information to payment source:<br />Success URL: <u>[success_url]</u><br /> Fail URL: <u>[failure_url]</u><br /><b>Optional:</b> Set the following information to the webhook URL:<br />Success URL: <u>[webhook_url]</u><br /><br /><br />');

DROP TABLE IF EXISTS `vivawalletdata`;
CREATE TABLE IF NOT EXISTS `vivawalletdata` (
  `hp_id` int(11) NOT NULL AUTO_INCREMENT,
  `hp_oid` int(11) NOT NULL,
  `hp_code` varchar(150) DEFAULT NULL,
  PRIMARY KEY (`hp_id`)
) ENGINE=InnoDB;

5) Copy the files to your store root (no files are overwritten), copy the files that are inside the skins/basic also to your used template (skins/yourusedtemplate).

6) Add the new payment method through your store admin area:

  • Select from dropdown template vivawallet.tpl.
  • Select from dropdown processor Viva Payments.
  • Select payment category Internet Payments (if available).
  • Add a title.
  • In the configure tab, specify an installment logic (optional).

7) Save the settings.

Step 3: Set an optional webhook

  1. Go to Settings > API Access > Webhooks in the Viva Wallet banking app:

    Webhooks tab

  2. Click on Create Webhook.
    The New Webhook dialog box is displayed:

    New webhook dialog box

  3. In the Url field, enter
    [webhook_url]
    exchanging the placeholder for your actual domain name.

  4. Choose Transaction Payment Created from the Event Type dropdown.

  5. Click on the Save button.