<p>I separately sought help on this issue from the BTCPay Server support channel, and with their help have devised a 'work-around' for this problem.</p>
<p>The initial response from their support is paraphrased below:</p>
<blockquote>
<p>BTCPay Server does not currently support API access to the wallet, and
it is not [currently] possible to generate ad-hoc receive addresses
programmatically.</p>
</blockquote>
<p>After a discussion, the method that I suggested in point 1 above seemed the most suitable:</p>
<ol>
<li>Generate a very low value invoice in BTCPay Server (for example, for 0.000001BTC).  In my case I set the invoice expiry to be 24 hours as my clients will not necessarily pay immediately.</li>
<li>Send the payment address\QR code to the client for payment.</li>
<li>The client makes a payment of whatever amount they have decided.</li>
<li>The invoice is marked as '<em>over-paid</em>'.  That is, the client paid more than the invoice amount.</li>
<li>In my software, I credit their account with the actual amount they paid.</li>
<li>Generate the next invoice for the client (which will need to be done each 24 hours as the invoices expire).</li>
</ol>
<p>Unlike BitPay, BTCPay Server <strong>does not automatically refund overpayments</strong>.  This is critical to the solution working - as I am expecting clients to pay an indeterminate amount but it will definitely be more than the very low invoice amount.</p>
<h1>References</h1>
<p>The following references are from my conversation with BTCPay Server support on their Mattermost support channel.</p>
<p><strong>Ref 1 (Receive addresses and wallet API):</strong></p>
<blockquote>
<p>So we don't have a wallet API yet. BTCPay is compatible for the most
part with BitPay's API. However, that API is not allowing the full
potential of the software, so we're working on crafting a way better
API. It's still in infancy you can preview docs here and in case you
have some feedback you can join the discussion on GitHub. We don't
have ETA when the new API will be fully ready, probably by the end of
the year.</p>
</blockquote>
<p><strong>Ref 2 (My proposed solution)</strong></p>
<blockquote>
<p>Thank you for the response. Can I ask if this that I am about to
describe is a viable work-around for now?</p>
<p>Create an invoice for each client for a low amount (such as
0.00001BTC) and then an address is available for a client to send payment to.  They send their payment (which will be higher than the
invoice amount) and then the invoice is flagged as over-paid.</p>
<p>This presumes that the over-paid amount will not be automatically
refunded to the client.</p>
<p>Once received I can then generate a brand new invoice for that client
so that they receive a new address.</p>
</blockquote>
<p><strong>Ref 2a (Their response)</strong></p>
<blockquote>
<p>sure that would work</p>
</blockquote>
<p><strong>Ref 3 (Invoice over-payments)</strong></p>
<blockquote>
<p>refunds are done by the merchant, not automatically</p>
</blockquote>

CC BY-SA 4.0
2020-06-21T15:23:07.903Z
2020-06-21T15:23:07.903Z
Martin
<p>Following advice from users on this site, I have implemented a BTCPay Server and got it set up to receive payments.  I am comfortable using the API.</p>
<p>My need is to set up receive addresses for many clients (1000+) but the clients pay indeterminate amounts.  That is, I cannot generate fixed-amount invoices for the clients because they pay whichever amount they wish to.</p>
<p>I need to generate a receive address for each client, and then credit their account balance (in USD) on my site with however much they sent to the address in BTC once it has been received and settled.</p>
<p><strong>Does anyone know how I can achieve this in BTCPay Server</strong>?  I have listed my ideas below but am looking for the 'correct' solution as opposed to what feels like a hack.</p>
<p><strong>Current Ideas</strong></p>
<ol>
<li><p>Generate an invoice for a tiny amount, and then handle the over-payment that the client makes when they send the BTC.  The over-payment must not be refunded.</p>
</li>
<li><p>Ask the client how much they are expecting to pay on the website and generate an invoice for about this amount.  I would love to avoid this method as the use case is for them to send however much they want to.</p>
</li>
</ol>

CC BY-SA 4.0
2020-06-24T17:21:55.590Z
While the workaround you describe seems reasonnable,but just out of curiosity I don't quite understand what's the problem with asking how much your client wants to pay and generate an invoice for that much? If I remember correctly it is something that can be done easily with BTCPay.
Sosthène
CC BY-SA 4.0
2020-06-25T08:51:03.933Z
@Sosthène The use case is for clients to be presented with a payment address and to send an amount of their choosing. The UI doesn't have a facility for them to specify how much they're paying. The software will then 'top up' their balance with the amount they paid to the address
Martin
<receiving><invoices><btcpay>
Using BTCPay To Accept Undefined Payment Amounts
Martin
# Using BTCPay To Accept Undefined Payment Amounts

(Asked by: username_0 on 2020-06-19)

Following advice from users on this site, I have implemented a BTCPay Server and got it set up to receive payments. I am comfortable using the API.

My need is to set up receive addresses for many clients (1000+) but the clients pay indeterminate amounts. That is, I cannot generate fixed-amount invoices for the clients because they pay whichever amount they wish to.

I need to generate a receive address for each client, and then credit their account balance (in USD) on my site with however much they sent to the address in BTC once it has been received and settled.

**Does anyone know how I can achieve this in BTCPay Server**? I have listed my ideas below but am looking for the 'correct' solution as opposed to what feels like a hack.

**Current Ideas**

1. Generate an invoice for a tiny amount, and then handle the over-payment that the client makes when they send the BTC. The over-payment must not be refunded.
2. Ask the client how much they are expecting to pay on the website and generate an invoice for about this amount. I would love to avoid this method as the use case is for them to send however much they want to.

**Tags:** receiving, invoices, btcpay

> **Comments:**
> **username_1**: While the workaround you describe seems reasonnable,but just out of curiosity I don't quite understand what's the problem with asking how much your client wants to pay and generate an invoice for that much? If I remember correctly it is something that can be done easily with BTCPay.  
> **username_0**: @username_1 The use case is for clients to be presented with a payment address and to send an amount of their choosing. The UI doesn't have a facility for them to specify how much they're paying. The software will then 'top up' their balance with the amount they paid to the address  

---

## 1 answers

### Answer by username_0 on 2020-06-21. Score: 3 | Accepted answer

I separately sought help on this issue from the BTCPay Server support channel, and with their help have devised a 'work-around' for this problem.

The initial response from their support is paraphrased below:

> BTCPay Server does not currently support API access to the wallet, and
> it is not [currently] possible to generate ad-hoc receive addresses
> programmatically.

After a discussion, the method that I suggested in point 1 above seemed the most suitable:

1. Generate a very low value invoice in BTCPay Server (for example, for 0.000001BTC). In my case I set the invoice expiry to be 24 hours as my clients will not necessarily pay immediately.
2. Send the payment address\QR code to the client for payment.
3. The client makes a payment of whatever amount they have decided.
4. The invoice is marked as '*over-paid*'. That is, the client paid more than the invoice amount.
5. In my software, I credit their account with the actual amount they paid.
6. Generate the next invoice for the client (which will need to be done each 24 hours as the invoices expire).

Unlike BitPay, BTCPay Server **does not automatically refund overpayments**. This is critical to the solution working - as I am expecting clients to pay an indeterminate amount but it will definitely be more than the very low invoice amount.

# References

The following references are from my conversation with BTCPay Server support on their Mattermost support channel.

**Ref 1 (Receive addresses and wallet API):**

> So we don't have a wallet API yet. BTCPay is compatible for the most
> part with BitPay's API. However, that API is not allowing the full
> potential of the software, so we're working on crafting a way better
> API. It's still in infancy you can preview docs here and in case you
> have some feedback you can join the discussion on GitHub. We don't
> have ETA when the new API will be fully ready, probably by the end of
> the year.

**Ref 2 (My proposed solution)**

> Thank you for the response. Can I ask if this that I am about to
> describe is a viable work-around for now?
>
> Create an invoice for each client for a low amount (such as
> 0.00001BTC) and then an address is available for a client to send payment to. They send their payment (which will be higher than the
> invoice amount) and then the invoice is flagged as over-paid.
>
> This presumes that the over-paid amount will not be automatically
> refunded to the client.
>
> Once received I can then generate a brand new invoice for that client
> so that they receive a new address.

**Ref 2a (Their response)**

> sure that would work

**Ref 3 (Invoice over-payments)**

> refunds are done by the merchant, not automatically


---

