How to Integrate BitPay Api with our website in c#.net? [Resolved]

Posted by Only4ram under ASP.NET on 10/18/2016 | Points: 10 | Views : 657 | Status : [Member] | Replies : 6
Dear Friends,

How to integrate bitpay payment method with asp.net website?




Responses

Posted by: Rajnilari2015 on: 10/18/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
a) First install BitPay C# Client through Nuget Package Manager

Install-Package BitPay


b) Client Initiated Paring

String clientName = "server 1";
BitPay bitpay = new BitPay(clientName);

if (!bitpay.clientIsAuthorized(BitPay.FACADE_POS))
{
// Get POS facade authorization code.
String pairingCode = bitpay.requestClientAuthorization(BitPay.FACADE_POS);

// Signal the device operator that this client needs to be paired with a merchant account.
System.Diagnostics.Debug.WriteLine("Info: Pair this client with your merchant account using the pairing code: " + pairingCode);
throw new BitPayException("Error: client is not authorized for POS facade.");
}


c) Server Initiated Paring

// Obtain a pairingCode from your BitPay account administrator. 
String pairingCode = "xxxxxxx";
String clientName = "server 1";
BitPay bitpay = new BitPay(clientName);

// Is this client already authorized to use the POS facade?
if (!bitpay.clientIsAuthorized(BitPay.FACADE_POS))
{
// Get POS facade authorization.
bitpay.authorizeClient(pairingCode);
}


An example with invoice is provided here ( https://github.com/bitpay/csharp-bitpay-client/blob/master/GUIDE.md )

Hope that helps

--
Thanks & Regards,
RNA Team

Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Only4ram on: 10/19/2016 [Member] Starter | Points: 25

Up
0
Down
That example link not working

Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Only4ram on: 10/19/2016 [Member] Starter | Points: 25

Up
0
Down
i got this error
Install-Package : The current environment doesn't have a solution open.
At line:1 char:1
+ Install-Package BitPay
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand

I am developing in normal asp.net not in MVC


Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajnilari2015 on: 10/19/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
Dear @Only4ram Sir, the problem you have encountered is of Nuget package. Might be the site is down. Please try after sometime.

--
Thanks & Regards,
RNA Team

Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Only4ram on: 10/19/2016 [Member] Starter | Points: 25

Up
0
Down
I got this error it this line
invoice = this.bitpay.createInvoice(invoice);


Refundable property

base = {"Object reference not set to an instance of an object."}


Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajnilari2015 on: 10/19/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
Because Nullable object properties cannot be referenced. (:

--
Thanks & Regards,
RNA Team

Only4ram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response