One charger, start to finish
1
Your user taps Connect charger
Your app opens Link for an action: what your user wants to do. Here that’s
add, to add a charger.2
The SDK asks your server for a client secret
The SDK calls your app’s callback, which asks your server. Your server asks Plugchoice for a client session for this user, and passes its secret back. Your own API credentials never leave your server.
3
Your user agrees to share their charger
The first time, Link asks your user whether you may see and control their chargers. This happens once per user.
4
Link sets up the charger
Your user picks their charger’s brand and follows the steps for it. Link does the technical work, such as joining the charger’s own Wi-Fi or talking to it over Bluetooth, and shows its progress as a checklist.
5
Link closes and tells your app
Your app gets the result: whether it worked, and which chargers were added. Your server confirms it with Plugchoice, and the charger is ready to use in your app.
The ideas behind it
Actions: what your user wants to do
Actions: what your user wants to do
Your app opens Link for one action at a time:
Everything except
add is about one charger, so you pass its id. ActionsClient sessions: a short-lived pass for one user
Client sessions: a short-lived pass for one user
A client session is like a visitor’s pass. Your server creates one for the signed-in user, and it says which chargers and sites that user may touch: its scope. It’s valid for an hour.Its client secret is what your app hands to the SDK. Because the scope is in the client session, a secret can’t reach the rest of your chargers, even if someone copies it. Client sessions
Link sessions: one time through Link
Link sessions: one time through Link
Each time your user goes through Link, Plugchoice keeps a record of it: a link session. It says how it ended (finished, left or failed) and which chargers it finished.Your app gets the link session’s id when Link closes and passes it to your server. Your server reads the link session from Plugchoice before it relies on the result, and checks it’s for the signed-in user. If your app never reports back, for example because it was closed, the link session is still there. Link sessions
Test and live: try it without risk
Test and live: try it without risk
You get test credentials first. Test mode works with real chargers, so you can try everything with your own. When your integration works, Plugchoice switches it to live. Test and live
Who does what
Next
Get started
Build the three pieces and add a charger, end to end.
Installation
Add the SDK to your iOS, Android or React Native app.