sessionId when Link closes. Your server reads it with Get a link session.
Statuses
abandon_reason is cancelled (your user closed Link), consent_declined (they chose Not now on the consent screen) or error. With error, error.code says why, for your logs, for example wifi_join_failed or charger_unreachable. New codes may be added: don’t branch on them.
The result in your app and the truth on your server
When Link closes, your app gets a result with:
The result is for your app’s screens. Before your server relies on it, it reads the link session itself:
- Your app sends
sessionIdto your server. - Your server calls
GET /sdk/v1/link-sessions/{id}and checks thatexternal_user_idis the signed-in user. - When
statusiscompleted, it stores the chargers indevices.
GET /sdk/v1/chargers?external_user_id=….
Chargers that belong to someone else
When your user adds a charger that is already connected to another Plugchoice account, Link can claim it for them. Plugchoice emails the current owner to approve it within 7 days. While the charger is online and not open to the public, your user can also prove they’re at the charger by plugging in a car. A claim can succeed after the link session has ended. The charger then appears at the link session’s site.claims in the link session shows each claim’s status:
While a claim is
pending, check the link session again later, for example once a day, or list the user’s chargers.