Ufänken Mat Privatsphär Gate op Node JS

Wann Dir plangt cryptocurrency Bezuelungen ze akzeptéieren an Dir sidd nach net vertraut wéi PrivacyGate funktionnéiert, ass et derwäert 5 Minutte vun Ärer Zäit ze verbréngen.

Lëscht vun verfügbare Krypto-Währungen: Bitcoin, Bitcoin Cash, Ethereum, Litecoin, USD Coin, Tether (ERC20), Dai, Chainlink.

Kuckt de Probeprojet op:https://github.com/privacyshore/privacygate-node-sample

alt

Also loosst eis ufänken.

Ier eppes weider geet

  1. Registering an PrivacyGate accountalt
  2. Navigating to the “settings” pagealt
  3. Generating an API keyaltalt
  4. Keep track of this API key as it will be needed in this tutorial

Nodeems Dir dëst gemaach hutt, fuert weider an Äert Entwécklungsëmfeld an ausféiert déi folgend Kommandoen:In case you have no project to work with as of right now, check out our sample project athttps://github.com/privacyshore/privacygate-node-sample

npm install privacygate

Dëst wäert d'privacygate nodejs Bibliothéik installéieren.

var privacygate = require('privacygate');
var Client = privacygate.Client;

var clientObj = Client.init('<API_KEY>');
clientObj.setRequestTimeout(3000);

Dëst wäert e Clientobjekt erstellen dee mir benotze kënne fir mat der Privacygate API ze interagéieren.

Dëst erlaabt eis verschidde Saachen ze maachen. Zum Beispill (betreffend Checkouts):

  1. Retrieve
var Checkout = privacygate.resources.Checkout;
Checkout.retrieve(<checkout_id>, function (error, response) {
  console.log(error);
  console.log(response);
});
  1. Create
var checkoutData = {
    'name': 'The Sovereign Individual',
    'description': 'Mastering the Transition to the Information Age',
    'pricing_type': 'fixed_price',
    'local_price': {
        'amount': '100.00',
        'currency': 'USD'
    },
    'requested_info': ['name', 'email']
};
Checkout.create(checkoutData, function (error, response) {
  console.log(error);
  console.log(response);
});

// or

var checkoutObj = new Checkout();

checkoutObj.name = 'The Sovereign Individual';
checkoutObj.description = 'Mastering the Transition to the Information Age';
checkoutObj.pricing_type = 'fixed_price';
checkoutObj.local_price = {
    'amount': '100.00',
    'currency': 'USD'
};
checkoutObj.requested_info = ['name', 'email'];

checkoutObj.save(function (error, response) {
  console.log(error);
  console.log(response);
});
  1. Update
var checkoutObj = new Checkout();

checkoutObj.id = <checkout_id>;
checkoutObj.name = 'new name';

checkoutObj.save(function (error, response) {
  console.log(error);
  console.log(response);
});
// or
var newParams = {
    'name': 'New name'
};

Checkout.updateById(<checkout_id>, newParams, function (error, response) {
  console.log(error);
  console.log(response);
});
  1. Delete
var checkoutObj = new Checkout();

checkoutObj.id = <checkout_id>;
checkoutObj.delete(function (error, response) {
 console.log(error);
 console.log(response);
});

// or

Checkout.deleteById(<checkout_id>, function (error, response) {
 console.log(error);
 console.log(response);  
});

Vuehttps://github.com/privacyshore/privacygate-node/tree/master/examples/resourcesfir méi Beispiller