-2

This is probably a stupid or easy question, but is it possible to use vb.net with the square app to accept and verify payments?

The Api for Square is here

https://docs.connect.squareup.com/api/connect/v1/#overview

But the functions only seem to relate to reporting. How do I offer a product for like $5 online using vb.net and use my Square App information to accept a payment online and then VERIFY they paid it? #1, can that be done? #2 Are there some code examples?

Jason Shoulders
  • 659
  • 1
  • 12
  • 24

1 Answers1

2

This is a timely question as Square just released a public playments API and updated the documentation a couple of days ago!

If you check back at connect.squareup.com, you'll see there's new documentation for the E-commerce APIs. It's a standard ReST-like HTTPS API, so you should be able to adapt the REST exmaple to VB and make the necessary requests yourself.

One vitally important thing to remember is that, as the documentation says, you should not pass the actual card details back to your own server. You'll want to follow the recommended path of obtaining card token (what Square calls a card_nonce) in JavaScript, then send that back to your VB server and charge it from there using the APIs.

Troy
  • 1,599
  • 14
  • 28
  • For this to work, does my server have to have Unirest installed? They make it seem as though I do. My hosting site is Brinkster and I'm doubting they will have that. In fact, I'm having trouble installing it on my PC to debug with - it says "We're currently updating Nuget to point to the latest package. In the meantime, please download this entire unirest-net library and reference it in your project." but I don't see a place to download. – Jason Shoulders Apr 30 '16 at 05:21
  • Unirest is one possible way to make HTTP requests, but it's not the only way. You can use any library you feel comfortable with. For example, [RestSharp](http://restsharp.org/) looks like another decent option. I'm not a dot.NET developer, so I can't really speak to the relative merits of different approaches. – Troy May 02 '16 at 21:01
  • Thanks for the reply. I appreciate it. Figuring this out is the last piece of a puzzle before I can get paid for my work on a project. Maybe I'm making this harder than it is. I have written an application in the past in VB.NET that I believe does "HTTP requests" like a POST. I set the ContentType, ContentLength, set up a data stream, write the data to the web site, and get back a response. Is it like that? I'll do some more digging and give that a shot, but it seems like SOMEONE should have done an example already for this in .NET. If it was in C# I could convert that pretty easily as well. – Jason Shoulders May 04 '16 at 18:43
  • Yes, that sounds about right. The Square payments API is pretty new, so you might not find any specific examples in .NET for it yet, but there's plenty of documentation on how to interact with JSON APIs I'm sure. I actually wrote [this project](https://github.com/tdeck/squaresharp) a while ago in C#, but it's read-only and only interacts with the Connect API so it probably won't help you. I'd encourage you to check out the RestSharp docs, and wish you the best with your project! – Troy May 04 '16 at 19:05
  • Not sure if you can help me with this or not, but I posted a problem I'm running into getting the card_nonce: http://stackoverflow.com/questions/37054021/need-to-get-cardnonce-and-cannot-get-callback – Jason Shoulders May 05 '16 at 15:05
  • Nevermind. I believe I fixed that. On to the next one. :) – Jason Shoulders May 05 '16 at 15:57
  • I figured out the CardNonce AND how to automatically get the LocationID but I'm getting an error on the last step trying to process the card using the CardNonce, LocationID, and amount to charge. http://stackoverflow.com/questions/37060582/getting-422-status-code-error-when-posting-to-square Any ideas? – Jason Shoulders May 05 '16 at 21:30
  • 1
    A new .NET client SDK was released, so you can get started with it here. https://docs.connect.squareup.com/articles/client-libraries/#csharpclientlibrary – jawspeak Aug 20 '16 at 18:33