This section describe how the payments and the refunds detection are made using Bitcoin as currency of a request.

The balance of a Bitcoin Request can be computed automatically.

First, One address for the payment and one for the refund must be created and used exclusively for one and only one request.

Then, the payment network "pn-bitcoin-address-based" must be given when creating a Bitcoin request:

const requestParameters = {
currency: RequestLogicTypes.CURRENCY.BTC,
expectedAmount: '100000000000',
payee: {
type: IdentityTypes.TYPE.ETHEREUM_ADDRESS,
value: '0x627306090abab3a6e1400e9345bc60c78a8bef57',
const paymentNetwork = {
parameters: {
paymentAddress: '1C83GMLVipjVMVaeV6BQkhfECT3TFADsfX',
const invoice = await requestNetwork.createRequest({
signer: requestParameters.payee,

Any bitcoin transaction reaching the payment address given (here "1C83GMLVipjVMVaeV6BQkhfECT3TFADsfX") is considered as a payment.

In the same way, the payer can add a refund address. For example when accepting the request:

await request.accept(payerIdentity, {
refundAddress: '1HorouyEMqtbHAvmnRj1XxEH4FL2uSiZpS',

Any bitcoin transaction reaching the refund address given (here "1HorouyEMqtbHAvmnRj1XxEH4FL2uSiZpS") is considered as a refund.

Note: To avoid counting change outputs, the bitcoin transactions having as input AND as ouput, the same payment or refund addresses are ignored.

Bitcoin Testnet

To use this payment network with the Bitcoin testnet, just use "pn-testnet-bitcoin-address-based" in the same way.

const paymentNetwork = {
parameters: {
paymentAddress: 'mgPKDuVmuS9oeE2D9VPiCQriyU14wxWS1v',


Specification Bitcoin payment specification: here.