Emitting Boletos for third-parties

🚧

Alpha Preview

This is a recent feature and may be subject to changes over time.

A Boleto can also be issued with a third party as payer. In this case it is necessary to provide additionally the payer details such as name, taxId (CPF or CNPJ), phone and address.

const me = await bitcapital.users().me();
const myWallet = me.wallets[0];

// Prepare the payer data for the Third Party
const source = {
  firstName: "John",
  lastName: "Connor",
  email: "[email protected]",
  role: "consumer",
  consumer: {
    taxId: "12345678901",
    birthday: "1985-11-12",
    phones: [{
      code: "19",
      number: "991044444",  
      type: "mobile"
    }],
    addresses: [{
      country: "Brasil",
      state: "SP",
      city: "São Paulo",
      code: "01310200",
      street: "Rua Caqui Natal",
      number: "501",
      neighborhood: "Vila Natal",
      complement: "Ap. 14",
    }]
  }
};

// Emit the boleto with a custom source
const boleto = await bitcapital.boletos().emit({
  amount: "100.00",
  destination: myWallet.id,
  extra: {
    source,
    expiresAt: "2019-10-19"
  }
});

// Once the payer account is created, which occurs after issuing the first  
// boleto in its name, you only need to provide the payer's taxId (CPF),
// as shown below.
const boleto = await bitcapital.boletos().emit({
  amount: "100.00",
  destination: myWallet.id,
  asset: 'BRLB',
  extra: {
    expiresAt: "2019-10-19",
    source: {
      consumer: { taxId: "12345678901" }
    }
  }
});


// Get boleto information, such as the payment code and bar code
console.log(boleto);
const me = await bitcapital.users().me();
const myWallet = me.wallets[0];

// Prepare the payer data for the Third Part
const source = {
  firstName: "The",
  lastName: "Firm",
  email: "[email protected]",
  role: "consumer",
  consumer: {
    type: "corporate",
    taxId: "60523459000100",
    birthday: "1985-11-12",
    phones: [{
      code: "19",
      number: "991044444",  
      type: "mobile"
    }],
    addresses: [{
      country: "Brasil",
      state: "SP",
      city: "São Paulo",
      code: "01310200",
      street: "Rua Caqui Natal",
      number: "501",
      neighborhood: "Vila Natal",
      complement: "Ap. 14",
    }]
  }
};

// Emit the boleto with a custom source
const boleto = await bitcapital.boletos().emit({
  amount: "100.00",
  destination: myWallet.id,
  extra: { source, expiresAt: "2019-10-19" }
});

// Once the payer account is created, which occurs after issuing the first  
// boleto in its name, you only need to provide the payer's taxId (CNPJ),
// as shown below.
const boleto = await bitcapital.boletos().emit({
  amount: "100.00",
  destination: myWallet.id,
  extra: {
    expiresAt: "2019-10-19",
    source: {
      consumer: { taxId: "60523459000100" }
    }
  }
});


// Get boleto information, such as the payment code and bar code
console.log(boleto);

Upon confirmation of payment by the custody provider, a deposit-type transaction will be created and recorded on the Stellar blockchain, resulting in the account balance being updated.


Available Providers

The following providers supports Boleto emissions, with its asset codes:

  • Banco BS2: BRLB
  • DOCK (Bradesco): BRLD (deprecated in 2.3.0)


Did this page help you?