Full Guide with Unity & Node.js
⏱️ 45-minute integration Sample integration between the frontend and backend. If you use a different language the concepts here should still apply and easy to follow.Getting Started
In this scenario, we will be using the following stack:- Unity as our game engine
- Node.js for our backend web server
Prerequisites
Before we get started here, let’s cover some requirements that are need to get going. Don’t worry, we go over each step here in detail. Feel free to skip around using the aside navigation.- Minimum Unity version: “unity”: “2021.3”
- Bolt Sandbox Account Make sure to check your spam folder for the verification email
- This is where you’ll get your API Key for your web server integration!
- Bolt Unity SDK
- Your Game’s Backend Web Server Integration
- Deep Links Enabled for your iOS Build
Your Bolt Sandbox Dashboard
Head on over to the Bolt Sandbox Dashboard and sign up for your Sandbox Account. Once you’re in, finish up the on-boarding steps to make sure you get a production-esque experience.
Getting through the Tasks (Tax Compliance)
⚠️ Setup Tax Compliance Provider We are currently working on automating or bypassing the Tax Setup in Sandbox accounts. For now, we need to manually flag this as complete. If you have any issues with on-boarding completion, please contact us directly and we will assist you with the configuration step. Thank you!Your API Key
Go into your Administration section to access you API key(s) and secret(s).
⚠️ Protect Your Keys!
When building out your web service integration, be sure to securely store your API key(s) in a non-public .env. Here is a helpful Strapi article touching upon that.
You will also need your Publishabke Key to generate your Payment URL.
Webhooks
It’s also important to get at least one webhook registered for your game studio.
Your First Payment Link!
Here is an example cURL request to dynamically generate a Payment URL: cURLExample ResponseUnity SDK
If you’re a Unity pro, you can just skip right through this and go source dive our GitHub repo. Otherwise, take your time and follow this guide and corresponding links to get better acquainted with the Bolt Unity SDK.- Download and install the Bolt Unity SDK [Read More]
- Set up an HTTP client (or use your existing one) within Unity for communicating with your web server [Read More]
- Implement the method calls to initate and open the native browser with Web Checkout via Bolt Payment URL’s [Read More]
- Enable deep links within your iOS build (Android coming soon)
- Hook into the Bolt Unity SDK event loop to handle success/failures from the browser; we have some raw source code with deep link integration examples here.
- Test, deploy, and game on!
Web Server Integration
We are going to be using Node.js as our backend server. It’s imperative that we have a minimal of two endpoints for this to work:- Payment URL Endpoint - This is the endpoint that your game will call to get a Payment URL from Bolt using the Bolt API.
- Transaction Webhook - This is the endpoint that Bolt will call to notify your game of a transaction’s status.