API Docs for Paydemic NodeJS SDK
Paydemic Documentation
Paydemic API is exposed through several libraries. Developers can use them to perform CRUDL operations on purchase links.
Paydemic Node.js SDK
API Overview
Every resource is accessed via your paydemic
instance:
var accessKey = require("<path>/accessKey.json")
var paydemic = require('paydemic')(accessKey);
// paydemic.{ RESOURCE_NAME }.{ METHOD_NAME }
Every resource method returns a promise, so you don’t have to use the regular callback. E.g.
// Create a new purchase link:
const purchaseLinkDefinition = {
finalUrl: 'https://paydemic.com/how-it-works.html',
price: {
currencyCode: 'USD',
amount: 9.9
},
title: 'Paydemic - How It Works'
};
paydemic.PurchaseLinks.create(purchaseLinkDefinition)
.then(function(purchaseLink) {
// New purchase link created
console.log('Created purchase link with id: ', purchaseLink.id);
}).catch(function(err) {
// Deal with an error
});
// retrieve an existing purchase link:
paydemic.PurchaseLinks.retrieve(id)
.then(function(purchaseLink) {
// New purchase link created
console.log('Retrieved the purchase link created at UTC: ', purchaseLink.creationDate);
}).catch(function(err) {
// Deal with an error
});
// List all the existing purchase links under this project:
paydemic.PurchaseLinks.list()
.then(function(purchaseLinkArray) {
// New purchase link created
console.log('The number of Purchase Links in this project is: ', purchaseLinkArray.length);
}).catch(function(err) {
// Deal with an error
});
// Update an existing purchase link:
const purchaseLinkDefinition = {
finalUrl: 'https://paydemic.com/faq.html',
price: {
currencyCode: 'USD',
amount: 3.76
},
title: 'Paydemic - FAQ'
};
paydemic.PurchaseLinks.update(id, purchaseLinkDefinition)
.then(function(purchaseLink) {
// The purchase link updated
console.log('Updated purchase link at UTC: ', purchaseLink.creationDate);
}).catch(function(err) {
// Deal with an error
});
// remove an existing purchase link:
paydemic.PurchaseLinks.remove(id)
.then(function(purchaseLinkRemovalStatus) {
// Purchase link was removed
console.log('Purchase link removal status: ', purchaseLinkRemovalStatus.status);
}).catch(function(err) {
// Deal with an error
});
Available resources & methods
Where you see params
it is a plain JavaScript object.
- PurchaseLinks