This is a follow up question to this post but my question is more programming related so I'm hoping this is the right place to post it.
I too am trying to use BTC Pay Server as a wallet. Thera are two problems:
- As described in the article, you have to specify an amount when creating an invoice.
- It has a security feature that basically results in you not being able to re-use deposit addresses.
The workaround for problem 1 is to set the invoice amount to 0.000001 BTC. So low that the client will always overpay. That works for me to.
But my problem is that address must not expire ever. I checked the code:
It looks like I might be able to use this:
public function setExpirationTime($expirationTime)
{
if (is_a($expirationTime, 'DateTime')) {
$this->expirationTime = $expirationTime;
} else if (is_numeric($expirationTime)) {
$expirationDateTime = new \DateTime('', new \DateTimeZone("UTC"));
$expirationDateTime->setTimestamp($expirationTime);
$this->expirationTime = $expirationDateTime;
}
return $this;
}
And set the expiration time to the year 3000. So my questions are:
- Will BTC Pay server ditch my address if I attempt to use this to make it never expire?
- Will I still receive the funds if a user sends to an expired address/
- Or is there perhaps a better way to get BTC Pay server to act as a wallet as I want it to?
Thanks!
Actually, you may encounter the year 2038 problem if the type for expirationTime is DateTime. If that really is the case, it will be set a negative value when you try to pass a value larger than 2038. It is unclear what will happen next.
If the system the code is running on is 64bit, then the Y2038 problem does not apply.
https://docs.btcpayserver.org/FAQ/FAQ-Stores/#payment-invalid-if-transactions-fails-to-confirm-minutes-after-invoice-expiration
So not exactly - some work is required on your part to accept it, if it expires.
Instead of setting it to the year 3000, why don't you just set the invoice a year ahead at a time ?