BitPay c# SDK Error : Unauthorized sin

331 Views Asked by At

I am implementing BitPay API using C# SDK.

I am doing this according to csharp-bitpay-client and BitPay C# client library configuration but unfortunately I am not achieving this.

Every time I get stuck at:

BitPay bitpay = new BitPay();

I also tried:

ECKey key = KeyUtils.createEcKey();
this.bitpay = new BitPay(key);

But key generates successfully but again I stuck here:

this.bitpay = new BitPay(key);

Every time I am getting this message from BitPay server:

{"error":"Unauthorized sin"}

Any one have idea about it?

And I am not seeing my public key on dashboard. Any one know why public key is not showing.

Thanks

1

There are 1 best solutions below

0
On

I realize this is really late, but this is the code using the BitPay C# SDK 5.0.1, BitPayToken is a property that returns with my pos string and the environment (Helper.BitPaySettings.BitPayEnvironment.Equals("Test")) is a string stored in my config to know which environment to pass.

using BitPay;

 public BitPay.Models.Invoice.Invoice RetrieveInvoice(string invoiceId)
    {
        PosToken token = new PosToken(BitPayToken);
        BitPay.Environment bpEnviro = Helper.BitPaySettings.BitPayEnvironment.Equals("Test")? BitPay.Environment.Test: BitPay.Environment.Prod;
       
        BitPay.Client bitPay = new BitPay.Client(token, bpEnviro);
        BitPay.Models.Invoice.Invoice invoice = bitPay.GetInvoice(invoiceId).Result;
        return invoice;
    }