JavaScript

const url = "https://staging.branta.pro/v2/payments";
const apiToken = "your token here";

const payload = {
  "destinations": [
    {
      "value": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
      "zk": false
    },
    {
      // Use encryption algorithm
      "value": await encrypt("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "my-secret"),
      "zk": true
    }
  ],
  "ttl": "86400"
}

const options = {
  method: "POST",
  headers: {
    "API_KEY": apiToken,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
};

fetch(url, options)
  .then(response => {
    console.log("Response Status Code:", response.status);
  })
  .catch(error => {
    console.error("An error occurred:", error);
  });

Last updated