magento-api-xmlrpc-extended

1.0.3 • Public • Published

Magento XMLRPC API Wrapper

Forked from https://www.npmjs.com/package/magento-api-xmlrpc

This wrapper lets you talk to Magento v1.x via XMLRPC. This is the most reliable and up to date magento wrapper, with lots of bug fixes and extended support for Ebizmart SagePay api end-points.

Original wrapper: bitbucket.org/icecom/magentoapi , developed by https://www.npmjs.com/~icecom and https://www.npmjs.com/~2ps.

Installation

npm i -S magento-api-xmlrpc-extended

Usage

const MagentoAPI = require('magento-api-xmlrpc-extended');
 
const magentoAPI = new MagentoAPI({
    host: 'shop-domain.com',
    port: 80,
    path: '/api/xmlrpc/',
    login: 'api_username',
    pass: 'api_password'
});
 
magentoAPI.login((error, sessionId) =>
{
    // Error
    if (error) {
        console.log('error', error);
        return;
    }
 
    // Test
    console.log('sessionId', sessionId);
 
    // Rest of your code...
});

If need be, you can manually change the session id.

magentoAPI.changeSession(newSessionId);

(Ebizmart) Sage Pay API Usage

List transactions

magentoAPI.sagePayTransaction.list((error, transactionList) => {
    if (error) {
        console.log('error', error);
        return;
    }
    console.log(transactionList);
});

Transaction Info

let request = { 
    'vpstxcode': 'EA049E74-A774-4322-80E6-1B317A90C2EB' 
};
magentoAPI.sagePayTransaction.info(request, (error, transactionInfo) => {
    if (error) {
        console.log('error', error);
        return;
    }
    console.log(transactionInfo);
});

All of the API methods take an object of params as the first argument, and a callback as the second.

Or, if no params are sent, just a callback as the first argument.

Methods

Package Sidebar

Install

npm i magento-api-xmlrpc-extended

Weekly Downloads

3

Version

1.0.3

License

MIT

Last publish

Collaborators

  • latheesan