I work on a dotnet desktop application and I’m looking to Create Payments in my sandbox. This is not a web application and I therefore do not have a frontend or backend; it’s just one application that does it all.
I understand I need to use sqpaymentform but I can’t for the life of me figure out how I can do this without a front end application. Is there any way to host the page from a desktop application?
No, as far as I know there’s no way to do this without a web page of some sort as it uses a Javascript library, and requires Javascript to load and generate a nonce. If you had a web page, you probably could put it in some sort of web view in .NET, but the web page would still need to be created of course.
I decided to switch to the Hosted Checkout Page solution instead of sqpaymentform. Seemed like it might work for us because then I can just open a URL and handle the response.
But when I run CreateCheckout() I get back an “AUTHORIZATION_ERROR - You Have Insufficient Privileges” error. This happens only when I use an OAuth access token. I tried adding every privilege, getting a new access token but no luck. When I use the access token provided in my Sandbox credentials page, I do not receive the error.
So for CreateCheckout you need PAYMENTS_WRITE and ORDERS_WRITE. If you’re confident that you included those, could you provide your application id as well as the merchant id (or location id) of the OAuth access token you’re trying to use? I can take a look on my side to see what’s going on.
I copy and pasted every permission so I’m confident I include those.
I don’t believe I had to provide a location ID when I got my AuthCode to get the OAuth Access Token. I provided the Application ID (sandbox-sq0idb-iLI9ILHlSvfja2YXpNc5iw) and made sure I was logged into my SalesPad Test Account (rather than then default test account).
The only location I have in my sandbox is the default one which has an ID of RDR6TV79A0M9H.
Hmmm could you share the OAuth authorize url you’re creating? For that location/merchant account I only see 4 permissions: MERCHANT_PROFILE_READ, PAYMENTS_READ, PAYMENTS_WRITE, and PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS, thus you’re missing ORDERS_WRITE to successfully call CreateCheckout.
Hmmm so now I’m really confused. The location you provided is a production location, but you’ve provided a sandbox oauth authorization link. If you’re trying to use production, you must use an OAuth production authorization link, as well as a production OAuth access token, as well as using the domain as “connect.squareup.com” instead of “connect.squareupsandbox.com”.
For that location, I do see you have the right permissions, so I suspect you’re either using the wrong domain or the wrong access token.
Ahhh this is making more sense to me now. I must have made the SalesPad app and assumed it would just use the default location in the sandbox. I didn’t realize it made a new location in Production.
Is there a way to make a new location in the Sandbox or is the default the only choice?