Press "Enter" to skip to content

Bitpay API Integration with Asp.NET Core Bitcoin Payment Gateway

Bitpay API Integration with Asp.NET Core Bitcoin Payment Gateway
Bitpay API Integration with Asp.NET Core Bitcoin Payment Gateway

Bitpay API Integration with Asp.NET Core : Bitcoin Payment Gateway lets go to test dot beat PACOM and click sign up is scrolling down this is sign up click business account click sign up here need to fill up all information to create an account lets verify then click create account account created lets verify through email address lets go to my mail click this one click on from email so you mail already verified lets verify other information business name lets find out address because my address will not work so I will use American and dress and going to any link you go to contact us and this address I will use copy this one paste it here and in filling out all other information here a software engineer industry phone number name but they verify so already verified lets create the bank account here need to specify a Bitcoin address lets generate Bitcoin address so go to generate Bitcoin address find out would be pay at rest generator this one click this one bit address dotorg this is the real bitcoin address generator but we want test net to generate lets delete this portion and type test net equal true and hit enter this is this will be the test net and move over your mouse cursor to generate 100 to generate the test net bitcoin address and this is the address theres copy this one address name and paste the address here is calling down click Save so now click Add is starting Bitcoin click payment tools payment buttons here giving a prize this is for testing its calling down this Bitcoin button will implement this is the big pay address invoice will implement in our application and this is a static price and we will work with the API version this can be scanned from mobile device lets copy this Bitcoin but on this piece of code we will insert in our code this is our website this is the payment page here we really specify Bitcoin button go to visual studio under this is stripe payment button we are inserting Bitcoin button here it is image and the close tag slash here and it will be inside the anchor tag so end anchor tag here the front anchor tag and each race this is the URL Bitcoin controller and the parameter calls ID well pass go to website refresh this and this is the Bitcoin payment button lets implement the Bitcoin controller go to visual studio is top debugging close this one is scrolling up copy Bitcoin control see right button click Add click controller click MVC controller empty add paste it here click Add here we need to write some code to get the course by ID so variable course context courses and this is the course we will get from the course ID and this is the user ID well get and this is the course price this is dynamic so different course different price order ID is course ID and copy this for number and paste it here because this after payment the user will redirect to this link so this will be Delta courses and the action method will be enroll yes this one copy and paste it here and slash and ID parameter need to pass so here course dot course ID and notification URL here this is the API web api the big pay will notify us the system so this need to be real domain the production server and this protocol must be htps and here the real payment will be applied after this the real payment will execute and then user can enroll the course so I came description the email address and posted eyes user ID lets add a folder API here we will implement our API controller and this will be the notification add controller ybp IMT api controller add here notification then click add and here very specifying the route and the extra action this is the type lets import all the dependencies copy this one and paste it here this need to be masked import import this one and done lets implement a certificate notification index this action method will be heat from bitpay website lets copy this payment action implementation this is the real payment happening and we can register the user with the course so that user can enroll this course and we can return ok the 200 success status delete this one and import this folder thats it lets download bitpay wallet because we need wallet because to pay Bitcoin its crawling down click these windows we are using Windows and click bit pay dot exe this software need to be installed in your mobile device or your desktop application to pay the invoice and go to beat pay testing website is trolling down click this one need to find out the faucet so that we can get Bitcoin so we can pay click this one and here we need to give your address lets run this program and close this one we already have open a tab this one lets repeat this page click OK go to insert some breakpoint to check here it homes and this is a course ID it will first time get exception step out it will pose a saying and the first time it will generate the the key it will step out this is the address we need to paste at the initial time copy this address and make sure you are already signed in in big pay website and paste it here and hit enter and this is the approve button to click click this one we are done the API token key already generated this is the ID we registered already now refresh this page step out now we will able to see the invoice page of big pay this is the lets write the email click continue Bitcoin click this is the QR code you can pay through your mobile device you can scan or copy the payment URL lets download be pay wallet because last time the download was fade download completed click this big P dot exe lets install the wallet okay next next need to create a desktop shortcut check this one and click Next click install it will install after install finish and it will open up the wizard of Bitcoin wallet click get started got it make sense create Bitcoin wallet we dont need password Im sure because this is testing and enter your email and continue click confirm and do it later no need backup for now I understand yes skip and need to check all of this to make sure everything is ok confirm and finish here personal wallet this is the real Bitcoin wallet we dont need this one because we need to generate click plus symbol add new personal wallet and this should be the test net wallet we need to generate give it a name the test of wallet click show advanced option because this is test net so need to check this one and create new wallet creating wallet no need password for now Im here and this is the wallet these need to be removed lets remove this one this is not backup settings is scrolling down click personal wallet and is scrolling down click more options delete a wallet click this one okay so this wallet tainted and click this one this is the stress net wallet currently no balance need to get feel Bitcoin close this one lets click receive and copy this public address through this address we can we will get few test net Bitcoin give this address here and click I am not a robot and verify this one click verify and click get bitcoins ok this one point 487 bitcoins already sent in our wallet lets check it it will take 5 to 10 seconds to get the result lets wait ok this already receiving and not received yet it will take time to receive like first time 10 to 20 minutes maximum 10 minutes 5 to 10 minutes so lets pay this invoice click this one is scrolling down copy payment URL lets go to a bit pay wallet lets click send a transaction not confirmed yet thats why not seeing the same and text boss lets restore this bitpay wallet click this one oh it takes two minute to get the Bitcoin actual transaction already happened already received now we can send Bitcoin so this is the Testament lets see it on blockchain click this one and we can see the transaction and its already confirmed you can see confirmation lets back lets click send and here need to specify the address need to paste the copied URL lets see the URL actually paste it here this is the address we will specify in this text box lets paste it here it will fetching the payment information and already first and this is a test bit paid comm information area click to pay click this one and confirm so it will send Bitcoin to this address payment already done but transaction real transaction not happened yet because it will take time to add to the block minor will mine then it will add in a blockchain it will take for test net 48 to 72 hours because we are giving the minor very low fee lets see the payment status open in new tab and confirmed transaction so when it will confirm that time real transaction happened and the bit pay address website will call our API so the user not paid yet lets manually pay lets go to sugar dotnet core we need to implement sugar in our application so that we can better visualize the EPI this sugar through this UI interface user interface we can easily manipulate with our Web API so lets install this shows buckle dot has been dotnet core this package lets install it tools up NuGet package manager console and paste it here and hit enter so it will install this package lets copy few code from this documentation copy this one it scrolling down ok copy need to find out is setup dots CS file to register this code inside the service layer dependency service layer configure service close this one is falling down the configure service here paste it lets resolve the dependency the sugar using ok still getting error were or we typed wrong copied wrong lets copy again this piece of code and select and paste it here is calling down this piece of code need to be specify this is the configure in middleware its crawling down and here anywhere you can insert inside this configure a method okay we are done lets insert a big point inside this modification action method index lets run this application lets write sugar and hit enter and it will go through all our code and get the API definition and this is the API already implemented lets expand this one click try it out we need to manipulate execute this API because this API will be called from bitpay website copy this course ID and paste it here and current user we need to identify this one to fit like here at yahoo.com this is the current user lets go to database expand this one tables lets select few rules and find out the user the user ID is this one copy this one and paste it here and click execute it will call this API and this user already paid and transaction already completed we are assuming that its really happening it will really happen after 48 and 72 hours later and the return is 200 so user already paid so transaction already happened and mine are already mined and it already added to the blockchain lets refresh this page the sole user can directly go to the course content page the user is not seeing any payment button for this course because this is are already paid in this course lets check other course here seeing this course not paid yet lets secure this API because we just manually hit this API because but we cannot call this API by ourself only beep a website can copy this one so we need to implement something so that only bitpay website can access this API close this one and scrolling down not here is calling up here the service layer here we need to specify the app policy and it is find out the test bitpay address lets find out yes this one copy this URL portion go to visual studio and paste in here so only bitpay can acts well increment we are registering first in the service layer and go to the documentation this this code we need to copy this is the middleware layer and in the configure method you can specify here anywhere you can want and it scrolling down need to find out action filter this is the action filter code and I will course and the add policy name exactly masked and need to specify below a certificate here lets import this one and in this way we can secure our API only bitpay can access now our API thats it this is our implementation

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *