Open didiandalucia opened 4 years ago
please share the code.
<?php /**
`<?php /**
I cna't tell why with what you are sharing. You can just activate "Allow anyone to create invoice" in your store settings / pay button.
Store setting "Allow anyone to create invoice" is set!
We met the same issue, and it was resolved by adding this when getting the invoice, before injecting the token in the client :
$token->setFacade('merchant');
This line is missing from a few places in the tutorial scripts, just like the private / public keys from IPNlogger.php.
I'll make a few push requests in a few days when I have time, as your project is really stellar !
@Alldebrid this is strange, the facade should be ignored by btcpayserver. Do you know exactly which call did not worked?
I'm getting 403 error too. I don't know what cause the problem. in server log it just say AuthenticationScheme: Bitpay was forbidden. example code for php is buggy and not working. some one with more experience with the project please fix the tutorial code. Or add more detail to the error log. I have the token and I updated the token value. I want to create invoice with code from tutorial 3. I'm testing on local host but BTCPayserver is not on localhost. if some one have a working code for simple php invoice please share.
Hey folks, for those having trouble with this, here are the steps:
First, you should create the pairing request with the API client. This is how I do it in Golang:
pemString := ku.GeneratePem()
id := ku.GenerateSinFromPem(pemString)
webClient := client.Client{ApiUri: BTCPAYSERVER, Insecure: true, Pem: pemString, ClientId: id}
token, err := webClient.PairWithFacade("merchant")
if err != nil {
log.Println("error sending request")
return
}
webClient.Token = token
log.Printf("%+v\n", webClient)
BTCPAYCLIENT = &webClient
This will generate the pairingCode that you must authorize server-side. The pairingCode is inside "Token" JSON payload that is returned to you by the server. You must MANUALLY authorize this token in the UI, by going to "http://yourbtcpayserver/api-access-request?pairingCode=xxxyyyzzz". Verify that the clientID is the same. Then authorize it. Then it will say pairing successful. Before this you cannot use that client to do anything, because the server will not recognize it. Hope it helps.
brings everytime an error:
Status Code: 403; Forbidden
and in the server:
info: BTCPayServer.Security.Bitpay.BitpayAuthenticationHandler: AuthenticationScheme: Bitpay was forbidden. info: BTCPayServer.Security.Bitpay.BitpayAuthenticationHandler: AuthenticationScheme: Bitpay was forbidden.