The HEP SDK provides a Javascript API for websites to integrate with NewID for user login and payments
- User has NewPay installed on their device and has set a NewID
- The Dapp or website requesting login has [registered on Newton's platform]
sequenceDiagram;
participant User;
participant DWEB;
participant NewPay;
participant HEP Node;
User->>DWEB: Click Login;
DWEB->>HEP Node: Session Request;
HEP Node->>HEP Node: Store Session and Generate UUID
HEP Node->>DWEB: UUID;
DWEB->>NewPay: QRCode (UUID)
NewPay->>HEP Node: Query UUID
HEP Node->> NewPay: DWEB info, loginUrl;
NewPay->>DWEB:Profile Info, Signature;
DWEB->>User:verify signature and Login success;
- Website displays Login with NewID button
- User clicks or taps button
- Website sends session request to [HEP Node]
- [HEP Node] stores session information and sends [UUID] back to website
- If on mobile, user is redirected to NewPay bringing [UUID]. Otherwise, website pops up a QR code for user to scan, containing [UUID]
- See [newpay.web.login.requestAccess]
- NewPay gets [UUID] from QR code or schema url
- NewPay sends [UUID] to [HEP Node]
- [HEP Node] uses [UUID] to query session information and website information that was registered in database
- [HEP Node] sends information back to NewPay
- NewPay opens and prompts user to authorize the website login based on information gathered from [HEP Node]
- User confirms login
- User sends login request to website, including NewID, personal information, [message] and [signature]
sequenceDiagram;
participant User;
participant DWEB;
participant NewPay;
participant HEP Node;
User->>DWEB:Click pay with NEW;
DWEB->>HEP Node: Session Request with AppId, OrderValue;
HEP Node->>HEP Node: Store Session and Generate UUID
HEP Node->>DWEB: UUID;
DWEB->>NewPay:QRCode(UUID);
NewPay->>HEP Node:Query Order by UUID;
HEP Node->>NewPay: OrderValue;
NewPay->>DWEB:Pay and send txid;
DWEB->>User:verify tx and Pay success;
- Website displays Pay with NewPay button
- User clicks or taps button
- Website sends session request to [HEP Node] including [order information]
- [HEP Node] sends [UUID] back to website
- If on mobile, user is redirected to NewPay. Otherwise, website pops up a QR code for user to scan, containing [UUID]
- See [newpay.web.payment.requestAccess]
Update:
- NewPay gets [UUID] through QR code or scheme url
- NewPay sends [UUID] to [HEP Node]
- HEP Node uses [UUID] to request website information that was registered in database and order information, and sends that information back to NewPay
- NewPay opens and prompts user to authorize the payment based on information gathered from HEP Node
- User confirms payment
- User's NewID is sent to website, with [message] and [signature]
- Payment receipt is sent to user and website
- User is redirected back to website
Old:
- NewPay gets public key of website through [signature] and [message] parameters
- NewPay sends public key to [HEP Node]
- HEP Node uses public key to request website information that was registered in database and order information, and sends that information back to NewPay
- NewPay opens and prompts user to authorize the payment based on information gathered from HEP Node
- User confirms payment
- User's NewID is sent to website, with [message] and [signature]
- Payment receipt is sent to user and website
- User is redirected back to website
sequenceDiagram;
participant User;
participant DWEB;
participant NewPay;
participant HEP Node;
participant NF API;
User->>DWEB:Click place order;
DWEB->>HEP Node:AppId, OrderInfo;
HEP Node->>NF API:Query Appid can place order;
NF API->>HEP Node:Place Order Status: true;
HEP Node->>HEP Node: Store Session and Generate UUID
HEP Node->>DWEB: UUID;
DWEB->>NewPay: QRCode (UUID)
NewPay->>HEP Node: Query UUID
HEP Node->>NewPay:Order Info;
NewPay->>DWEB:sign hash, txid, order hash;
DWEB->>User:Place Order Success;
NewPay->>HEP Node:sign hash, txid;
HEP Node->>NF API:hash, txid;
NF API->>HEP Node:Query Order;
HEP Node->>NF API:Order;
NF API->>NF API: Calculate NF;
Update
- Website displays Place Order button
- User clicks or taps button
- If on mobile, user is redirected to NewPay. Otherwise, website pops up a QR code for user to scan, containing UUID
Old
- Website displays Place Order button
- User clicks or taps button
- If on mobile, user is redirected to NewPay. Otherwise, website pops up a QR code for user to scan, containing order hash, AppID and Action Type
Update
- DWeb posts order info to HEP-Node;
- HEP-Node verifies order info and query the DWEB's status, which can place order or not,if true, return the the order hash, else return false.
- HEP-Node stores the session information including order hash, AppID and Action Type
- HEP-Node sends the UUID of the session to DWeb
- DWeb shows QRCode for user to scan, containing UUID
- Newpay scan the QRCode and sign the order hash, then return the txid to DWeb and HEP-Node.
- NF-API get the order info by hash and calculate the NF.
Old
- DWeb Post order info to HEP-Node;
- HEP-Node verify order info and query the DWEB's status, which can place order or not,if true, return the the order hash, else return false.
- Show QRCode for user to scan, containing order hash, AppId and Action Type.
- Newpay scan the QRCode and sign the order hash, then return the txid to DWeb and HEP-Node.
- NF-API get the order info by hash and calculate the NF.