npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

epayco-node

v0.0.7

Published

Epayco API client for node.js

Downloads

471

Readme

Epayco

Node wrapper for Epayco API

Description

API to interact with Epayco https://epayco.co/docs/api/

Installation

As usual, you can install it using npm.

$ npm install epayco-node

Usage

var epayco = require('epayco-node')({
    apiKey: 'PUBLIC_KEY',
    privateKey: 'PRIVATE_KEY',
    lang: 'ES',
    test: true
})

Create Token

var credit_info = {
    "card[number]": "4575623182290326",
    "card[exp_year]": "2025",
    "card[exp_month]": "12",
    "card[cvc]": "123"
}
epayco.token.create(credit_info)
    .then(function(token) {
        console.log(token);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Customers

Create

var customer_info = {
    token_card: "toke_id",
    name: "Joe",
    last_name: "Doe", //This parameter is optional
    email: "[email protected]",
    default: true,
    //Optional parameters: These parameters are important when validating the credit card transaction
    city: "Bogota",
    address: "Cr 4 # 55 36",
    phone: "3005234321",
    cell_phone: "3010000001"
}
epayco.customers.create(customer_info)
    .then(function(customer) {
        console.log(customer);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Retrieve

epayco.customers.get("id_customer")
    .then(function(customer) {
        console.log(customer);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

List

epayco.customers.list()
    .then(function(customers) {
        console.log(customers);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Update

var update_customer_info = {
    name: "Alex"
}
epayco.customers.update("id_customer", update_customer_info)
    .then(function(customer) {
        console.log(customer);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Delete Token

var delete_customer_info = {
    franchise : "visa",
    mask : "457562******0326",
    customer_id:"id_customer"
}
epayco.customers.delete(delete_customer_info)
    .then(function(customer) {
        console.log(customer);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Plans

Create

var plan_info = {
    id_plan: "coursereact",
    name: "Course react js",
    description: "Course react and redux",
    amount: 30000,
    currency: "cop",
    interval: "month",
    interval_count: 1,
    trial_days: 30
}
epayco.plans.create(plan_info)
    .then(function(plan) {
        console.log(plan);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Retrieve

epayco.plans.get("id_plan")
    .then(function(plan) {
        console.log(plan);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

List

epayco.plans.list()
    .then(function(plans) {
        console.log(plans);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Remove

epayco.plans.delete("id_plan")
    .then(function(plan) {
        console.log(plan);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Subscriptions

Create

var subscription_info = {
    id_plan: "-id_plan",
    customer: "id_customer",
    token_card: "id_token",
    doc_type: "CC",
    doc_number: "5234567"
}
epayco.subscriptions.create(subscription_info)
    .then(function(subscription) {
        console.log(subscription);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Retrieve

epayco.subscriptions.get("id_subscription")
    .then(function(subscription) {
        console.log(subscription);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

List

epayco.subscriptions.list()
    .then(function(subscriptions) {
        console.log(subscriptions);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Cancel

epayco.subscriptions.cancel("id_subscription")
    .then(function(subscription) {
        console.log(subscription);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Pay Subscription

var subscription_info = {
    id_plan: "-id_plan",
    customer: "id_customer",
    token_card: "id_token",
    doc_type: "CC",
    doc_number: "5234567"
}
epayco.subscriptions.charge(subscription_info)
    .then(function(subscription) {
        console.log(subscription);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

PSE

Create

var pse_info = {
    bank: "1022",
    invoice: "1472050778",
    description: "pay test",
    value: "10000",
    tax: "0",
    tax_base: "0",
    currency: "COP",
    type_person: "0",
    doc_type: "CC",
    doc_number: "10358519",
    name: "testing",
    last_name: "PAYCO",
    email: "[email protected]",
    country: "CO",
    cell_phone: "3010000001",
    url_response: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
    url_confirmation: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
    method_confirmation: "GET",
    //Extra params: These params are optional and can be used by the commerce
    extra1: "",
    extra2: "",
    extra3: "",
    extra4: "",
    extra5: "",
    extra6: "",
    extra7: "",
}
epayco.bank.create(pse_info)
    .then(function(bank) {
        console.log(bank);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Retrieve

epayco.bank.get("transaction_id")
    .then(function(bank) {
        console.log(bank);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Cash

Create

var cash_info = {
    invoice: "1472050778",
    description: "pay test",
    value: "20000",
    tax: "0",
    tax_base: "0",
    currency: "COP",
    type_person: "0",
    doc_type: "CC",
    doc_number: "10358519",
    name: "testing",
    last_name: "PAYCO",
    email: "[email protected]",
    cell_phone: "3010000001",
    end_date: "2017-12-05",
    url_response: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
    url_confirmation: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
    method_confirmation: "GET",
}
epayco.cash.create("efecty", cash_info)
    .then(function(cash) {
        console.log(cash);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Retrieve

epayco.cash.get("transaction_id")
    .then(function(cash) {
        console.log(cash);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Split Payments

Previous requirements: https://docs.epayco.co/tools/split-payment

var split_cash_info = {
    //Other customary parameters...
    splitpayment: "true",
    split_app_id: "P_CUST_ID_CLIENTE APPLICATION",
    split_merchant_id: "P_CUST_ID_CLIENTE COMMERCE",
    split_type: "02",
    split_primary_receiver: "P_CUST_ID_CLIENTE APPLICATION",
    split_primary_receiver_fee: "10",
    split_receivers: JSON.stringify([{id:"P_CUST_ID_CLIENTE 1ST RECEIVER",fee:"1000",fee_type: "01"}])
}
epayco.cash.create("efecty", split_cash_info)
    .then(function(cash) {
        console.log(cash);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Payment

Create

var payment_info = {
    token_card: "token_id",
    customer_id: "customer_id",
    doc_type: "CC",
    doc_number: "1035851980",
    name: "John",
    last_name: "Doe",
    email: "[email protected]",
    bill: "OR-1234",
    description: "Test Payment",
    value: "116000",
    tax: "16000",
    tax_base: "100000",
    currency: "COP",
    dues: "12",
    //Extra params: These params are optional and can be used by the commerce
    extras: {
        extra1: "",
        extra2: "",
        extra3: "",
        extra4: "",
        extra5: "",
        extra6: ""
    }
}
epayco.charge.create(payment_info)
    .then(function(charge) {
        console.log(charge);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Retrieve

epayco.charge.get("transaction_id")
    .then(function(charge) {
        console.log(charge);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });

Split Payments

Previous requirements: https://docs.epayco.co/tools/split-payment

var split_payment_info = {
    //Other customary parameters...
    splitpayment: "true",
    split_app_id: "P_CUST_ID_CLIENTE APPLICATION",
    split_merchant_id: "P_CUST_ID_CLIENTE COMMERCE",
    split_type: "02",
    split_primary_receiver: "P_CUST_ID_CLIENTE APPLICATION",
    split_primary_receiver_fee: "10",
    split_receivers: [{id:"P_CUST_ID_CLIENTE 1ST RECEIVER",fee:"1000",fee_type: "01"}]
}
epayco.charge.create(split_payment_info)
    .then(function(charge) {
        console.log(charge);
    })
    .catch(function(err) {
        console.log("err: " + err);
    });