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 to agree to the scopes you ask for, such as seeing their charging sessions or controlling their charger. It asks again only when you ask for more. See Consent and branding.
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
Your user signs in to Plugchoice
The charger goes to your user’s own Plugchoice account, and you get access to it with the scopes they agreed to. Your user signs in, or creates an account, with a code by email, Google or Apple, and picks the site it goes to. When Plugchoice set your integration up so the chargers go to your team, there’s no sign-in.
6
Your user checks what's saved
Link shows what it saves with the charger: the settings it read or asked for, the cards and charging history it found on the charger, and the operator it keeps. When the charger had no other operator, Link first asks whether your user uses one, such as a platform that bills charging sessions to an employer.
7
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.