connector-digital-femsa
v0.0.1
Published
Servicio para consumir los recursos de la pasarela de pagos DIGITAL FEMSA
Downloads
62
Readme
Features
- Package that allows us to connect to DigitalFemsa and make use of the following resources.
Installation
$ npm install connector-digital-femsa
Basic
Connector to use DIGITAL FEMSA's customer service, orders, webhooks, plans and subscriptions.
Examples
Create Customer
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const customer = {
"name": "Fulanito Mengano",
"email": "[email protected]",
"phone": "520000000000"
};
DigitalFemsaServices.Customer.create({ apiKeys, customer }).then(resolve => {
//..
});
Get Customer
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const customer = "cus_54FDl0sf4d74F"
DigitalFemsaServices.Customer.get({ apiKeys, customer }).then(resolve => {
//..
});
Create Webhook
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const webhook = {
"url": "https://www.google.coom",
"synchronous": false
};
DigitalFemsaServices.Webhook.create({ apiKeys, webhook }).then(resolve => {
//..
});
Get Webhook
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const webhook = "web_G45fdg54Fgh4Hj4hg"
DigitalFemsaServices.Webhook.get({ apiKeys, webhook }).then(resolve => {
//..
});
Get All Webhook
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
DigitalFemsaServices.Webhook.all({ apiKeys }).then(resolve => {
//..
});
Delete Webhook
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const webhook = "web_G45fdg54Fgh4Hj4hg";
DigitalFemsaServices.Webhook.delete({ apiKeys, webhook }).then(resolve => {
//..
});
Create Order by SPEI
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const order = {
"customer_info": "cus_zzmpLsnM1oayuCwV7",
"line_items": [
{
"unit_price": 25000
}
],
"charges": {
"type": "spei",
"reference_id": "tr454SDsa45sdDS8",
"expires_at": "2022-12-30 23:59:59"
};
DigitalFemsaServices.Order.create({ apiKeys, order }).then(resolve => {
//..
});
Create Order by CASH
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const order = {
"customer_info": "cus_zzmpLsnM1oayuCwV7",
"line_items": [
{
"unit_price": 25000
}
],
"charges": {
"type": "oxxo_cash",
"reference_id": "tr454SDsa45sdDS8",
"expires_at": "2022-12-30 23:59:59"
};
DigitalFemsaServices.Order.create({ apiKeys, order }).then(resolve => {
//..
});
Create Order by CARD
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const order = {
"customer_info": "cus_zzmpLsnM1oayuCwV7",
"line_items": [
{
"unit_price": 158050
}
],
"charges": {
"type": "card",
"token": "tok_test_visa_4242",
"reference_id": "tr454SDsa45sdDS8",
"expires_at": "2022-12-30 23:59:59"
};
DigitalFemsaServices.Order.create({ apiKeys, order }).then(resolve => {
//..
});
Create Plan
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const plan = {
"id": "Plan-12345",
"name": "Annual plan",
"amount": 150.00,
"interval": "year",
"frequency": 1,
"trial_days": 30,
"expiry_count": "12"
};
DigitalFemsaServices.Plan.create({ apiKeys, plan }).then(resolve => {
//..
});
Get Plan
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const plan = "Plan-12345";
DigitalFemsaServices.Plan.get({ apiKeys, plan }).then(resolve => {
//..
});
Get All Plans
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
DigitalFemsaServices.Plan.all({ apiKeys }).then(resolve => {
//..
});
Create Subscription
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const subscription = {
"customer_id": "cus_2swgCXBfKRPXFmzWe",
"card_id": "src_2swgCXQXtsDTaEu8F",
"plan_id": "Plan-1670255300"
};
DigitalFemsaServices.Subscription.create({ apiKeys, subscription }).then(resolve => {
//..
});
Update Subscription
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const subscription = {
"customer_id": "cus_2swgCXBfKRPXFmzWe",
"card_id": "src_2swgCXQXtsDTaEu0X",
"plan_id": "Plan-1670255389"
};
DigitalFemsaServices.Subscription.update({ apiKeys, subscription }).then(resolve => {
//..
});
Cancel Subscription
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const subscription = {
"customer_id": "cus_2swgCXBfKRPXFmzWe"
};
DigitalFemsaServices.Subscription.cancel({ apiKeys, subscription }).then(resolve => {
//..
});
Create Empty Card Token
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const token = {
"checkout": {
"returns_control_on": "Token"
}
};
DigitalFemsaServices.Card.createToken({ apiKeys, token }).then(resolve => {
//..
});
Create Card
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const card = {
"customer_id": "cus_2swgCXBfKRPXFmzWe",
"type": "card",
"token_id": "tok_2syGE69YFkHe1Ed5d"
};
DigitalFemsaServices.Card.create({ apiKeys, card }).then(resolve => {
//..
});
Delete Existing Card
const DigitalFemsaServices = require("connector-digital-femsa");
const apiKeys = {
"publicKey": "key_XXXXXXXXXXXXXXXXXXXXXXX",
"privateKey": "key_XXXXXXXXXXXXXXXXXXXXXXX"
};
const card = {
"customer_id": "cus_2swgCXBfKRPXFmzWe",
"card_id": "src_2swgCXQXtsDTaEu8F"
};
DigitalFemsaServices.Card.cancel({ apiKeys, card }).then(resolve => {
//..
});