### Example Request for User Card List Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/users/inquiry-user-card-list Demonstrates how to make a GET request to the user card list endpoint. ```javascript fetch("https://api.example.com/users/cards", { method: "GET", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error("Error:", error)); ``` -------------------------------- ### Install Go on Linux Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install Go on Ubuntu/Debian-based Linux distributions using apt. ```bash sudo apt update && sudo apt install golang-go ``` -------------------------------- ### Install Go on macOS Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install Go using Homebrew on macOS. ```bash brew install go ``` -------------------------------- ### Install Frontend Dependencies Source: https://superqi-dev-docs.pages.dev/llms-full.txt Navigate to the frontend directory of the Super Qi Demo Miniapp and install its npm packages. ```bash cd superqi-demo-miniapp/frontend npm install ``` -------------------------------- ### Check Go Installation Source: https://superqi-dev-docs.pages.dev/llms-full.txt Verify if the Go programming language is installed. Go is recommended for the backend. ```bash go version ``` -------------------------------- ### Install Frontend Dependencies Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install the necessary Node.js dependencies for the frontend application. ```bash npm install ``` -------------------------------- ### Ready Implementation Usage Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Example of using the ready implementation URL format for deep links. Replace placeholders with your Miniapp ID and path/query parameters. ```bash https://deeplink.qi.iq/[0]/[1] ``` -------------------------------- ### Go Application Entry Point Setup Source: https://superqi-dev-docs.pages.dev/llms-full.txt Illustrates the initialization steps for the Go backend application, including environment variable loading, Alipay+ client setup, and server bootstrapping. ```go # File: main.go (lines 15-42) # Load environment variables from .env file # Initialize Alipay+ client with credentials # Create Fiber app instance # Configure CORS and recovery middleware # Register API route handlers under /api prefix # Start server on port 1999 (default) or PORT env variable ``` -------------------------------- ### Node.js Application Entry Point Setup Source: https://superqi-dev-docs.pages.dev/llms-full.txt Illustrates the initialization steps for the Node.js backend application, including environment variable loading, Alipay+ client setup, and server bootstrapping. ```javascript # File: src/index.js (lines 13-48) # Load environment variables from .env file # Initialize Alipay+ client with credentials (async) # Create Express app instance # Configure CORS middleware # Parse JSON and URL-encoded request bodies # Register API route handlers under /api prefix # Start server on port 1999 (default) or PORT env variable ``` -------------------------------- ### Basic my.prompt Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Demonstrates a simple usage of the my.prompt API to get user input for their name. It logs the entered value or a cancellation message to the console. ```javascript my.prompt({ title: 'Enter Name', message: 'Please enter your full name', placeholder: 'John Doe', success: (result) => { if (result.ok) { console.log('User entered:', result.inputValue); } else { console.log('User cancelled'); } }, }); ``` -------------------------------- ### Check Git Installation Source: https://superqi-dev-docs.pages.dev/llms-full.txt Verify if Git is installed on your system. If not, follow the provided installation instructions for your operating system. ```bash git --version ``` -------------------------------- ### Install Git on Linux Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install Git on Ubuntu/Debian-based Linux distributions using apt. ```bash sudo apt update && sudo apt install git ``` -------------------------------- ### Nuxt Configuration Example Source: https://superqi-dev-docs.pages.dev/api-reference/jsapi/storage-apis/set-storage Example of Nuxt.js configuration, showing settings for content modules, MDC components, and anchor link behavior in headings. ```json window.__NUXT__={};window.__NUXT__.config={public:{content:{wsUrl:""},mdc:{components:{prose:true,map:{"accordion":"ProseAccordion","accordion-item":"ProseAccordionItem",badge:"ProseBadge",callout:"ProseCallout",card:"ProseCard","card-group":"ProseCardGroup",caution:"ProseCaution","code-collapse":"ProseCodeCollapse","code-group":"ProseCodeGroup","code-icon":"ProseCodeIcon","code-preview":"ProseCodePreview","code-tree":"ProseCodeTree",collapsible:"ProseCollapsible",field:"ProseField","field-group":"ProseFieldGroup",icon:"ProseIcon",kbd:"ProseKbd",note:"ProseNote",steps:"ProseSteps",tabs:"ProseTabs","tabs-item":"ProseTabsItem",tip:"ProseTip",warning:"ProseWarning"}}},headings:{anchorLinks:{h1:false,h2:true,h3:true,h4:true,h5:false,h6:false}}}},app:{baseURL:"/",buildId:"db931f48-332f-472e-88e0-415a7372cc5e",buildAssetsDir:"/_nuxt/",cdnURL:""}}; ``` -------------------------------- ### Install Backend Dependencies (Node.js) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Navigate to the backend-node directory and install the npm packages required for the backend. ```bash cd superqi-demo-miniapp/backend-node npm install ``` -------------------------------- ### Install Backend Dependencies (Go) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Navigate to the backend-go directory and download the Go modules required for the backend. ```bash cd superqi-demo-miniapp/backend-go go mod tidy go mod download ``` -------------------------------- ### Install Git on macOS Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install Git using Homebrew on macOS if it's not already installed. ```bash brew install git ``` -------------------------------- ### Check Node.js and npm Installation Source: https://superqi-dev-docs.pages.dev/llms-full.txt Verify if Node.js and npm are installed. These are required for package management. ```bash node --version npm --version ``` -------------------------------- ### AI Documentation Usage Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Example of how to instruct an AI chat model to use the provided documentation URL for Super Qi Mini Program development assistance. ```text Please read https://superqi-dev-docs.pages.dev/llms.txt and help me with Super Qi Mini Program development ``` -------------------------------- ### Run Frontend Development Server Source: https://superqi-dev-docs.pages.dev/llms-full.txt Start the frontend development server with host mode enabled to expose it on your network. ```bash npm run dev -- --host ``` -------------------------------- ### Complete HTTP Request Headers Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt This example shows the required headers for a complete HTTP request to Super Qi OpenAPIs. ```http Content-Type: application/json; charset=UTF-8 Client-Id: 2021001234567890 Request-Time: 2024-01-01T12:00:00-07:00 Signature: algorithm=RSA256, keyVersion=1, signature=base64_encoded_signature ``` -------------------------------- ### Sign Content Generation Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt This example demonstrates how to construct the content string for signature generation by combining HTTP method, path, client ID, request time, and JSON content. ```text POST /v1/authorizations/applyToken 2021001234567890.2024-01-01T12:00:00-07:00.{"grantType":"AUTHORIZATION_CODE","authCode":"281011130..."} ``` -------------------------------- ### Install Yarn Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install Yarn globally using npm if you prefer using Yarn for package management. ```bash npm install -g yarn ``` -------------------------------- ### Example API Request URL Source: https://superqi-dev-docs.pages.dev/llms-full.txt Shows specific examples of how to construct the full request URL for different Super Qi API endpoints. ```text https://api.superqi.iq/api/v1/payments/pay https://api.superqi.iq/api/v1/authorizations/applyToken https://api.superqi.iq/api/v1/payments/refund ``` -------------------------------- ### Callback Payload Example (Business User) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Example of the callback payload when the user is a business account. ```json { "language": "en-US", "isProdEnv": "true", "currentRole": "business", "systemInfo": "Android 15", "hardwareInfo": "HONOR_PGT-AN00", "loginTime": "360307579" } ``` -------------------------------- ### Standard API Async/Await Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Illustrates using async/await syntax with standard JSAPIs for cleaner asynchronous code handling. ```javascript async function fetchData() { try { const res = await my.httpRequest({ url: '/api/data' }); console.log('Data:', res.data); } catch (res) { console.log('Error:', res.error, res.errorMessage); } } ``` -------------------------------- ### HTTP Response Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt An example of a complete HTTP response, including headers and a JSON body indicating an accepted status. ```http HTTP/1.1 200 OK Content-Type: application/json; charset=UTF-8 Response-Time: 2024-11-15T14:30:01.234+03:00 { "result": { "resultCode": "ACCEPT", "resultStatus": "A", "resultMessage": "accept" }, "paymentId": "2023120611121280010016600900000xxxx", "redirectActionForm": { "redirectionUrl": "https://www.wallet.com/cashier?orderId=xxxxxxx" } } ``` -------------------------------- ### Example POST Request Method Source: https://superqi-dev-docs.pages.dev/llms-full.txt Demonstrates the HTTP POST method used for all OpenAPI requests, including the path and host. ```http POST /v1/payments/pay Host: api.superqi.iq ``` -------------------------------- ### Standard API Callback Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Demonstrates how to use the success, fail, and complete callbacks for a standard JSAPI like my.httpRequest. ```javascript my.httpRequest({ url: '/api/data', success(res) { console.log('Success:', res.data); }, fail(res) { console.log('Error:', res.error, res.errorMessage); }, complete(res) { console.log('Request completed'); } }); ``` -------------------------------- ### Example Email for Mini App Security Review Source: https://superqi-dev-docs.pages.dev/llms-full.txt An example email to send to the Miniapp Team for security review. It includes all necessary information such as QR code, Mini App details, API documentation, and test credentials. ```text To: hani.salih@qi.iq CC: mouamle.hameed@qi.iq Subject: Mini App Security Review Request - [Your Mini App Name] Hello team, Our Mini App "Example App" (v1.0.0) is ready for production release and security review. Attached is the permanent QR code. Mini App Name: Example App Mini App Purpose: This Mini App is an e-commerce platform that allows users to browse products, add items to cart, and make payments using QiCard. Users can view their order history and track deliveries. How it operates: - Users authenticate using my.getAuthCode and applyToken - Product browsing and cart management - Payment processing via cashier payment flow (my.tradePay) - Order tracking and history API Documentation: - Swagger: https://api.example.com/swagger - Postman Collection: https://api.example.com/postman-collection.json - Manual API description: Our backend exposes REST APIs for product management (GET /api/products, POST /api/orders), user authentication (POST /api/auth/login), and payment processing (POST /api/payments). All endpoints require Bearer token authentication. Request/response formats follow JSON standards. Test User Credentials: We will provide a dedicated test account in our dashboard for your security testing with the following roles: - Admin Role (full access to dashboard and administrative functions) - Regular User Role (standard customer access) Username: securityTestUser Password: abc123 Please proceed with the security review. Thank you! ``` -------------------------------- ### Agreement Payment - Prepare Source: https://superqi-dev-docs.pages.dev/llms-full.txt Prepares authorization for agreement payment setup. ```APIDOC ## POST /api/agreement/prepare ### Description Prepares authorization for agreement payment setup. This is the first step in setting up recurring charges. ### Method POST ### Endpoint /api/agreement/prepare ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body *Details of the request body are not provided in the source text.* ### Request Example *No request example provided in the source text.* ### Response #### Success Response (200) *Details of the success response are not provided in the source text.* #### Response Example *No response example provided in the source text.* ``` -------------------------------- ### my.alert Usage Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Demonstrates how to call the my.alert API with specific content, title, button text, and a success callback. ```javascript my.alert({ title: 'Payment Successful', content: 'Your order has been confirmed', buttonText: 'OK', success() { console.log('User closed the alert'); } }); ``` -------------------------------- ### Confirm Order Request Example (Node.js) Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/payments/confirm-order Example of how to make a POST request to confirm an order using Node.js with the 'axios' library. Ensure you have the correct order ID and API key. ```javascript const axios = require('axios'); const orderId = 'YOUR_ORDER_ID'; const apiKey = 'YOUR_API_KEY'; const apiUrl = 'https://api.example.com/v1/payments/orders/' + orderId + '/confirm'; axios.post(apiUrl, null, { headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' } }) .then(response => { console.log('Order confirmed successfully:', response.data); }) .catch(error => { console.error('Error confirming order:', error.response ? error.response.data : error.message); }); ``` -------------------------------- ### Get Saved File Information Source: https://superqi-dev-docs.pages.dev/llms-full.txt Retrieves information about a file previously saved using `my.saveFile`. Requires the saved file path. This example chains `chooseImage`, `saveFile`, and `getSavedFileInfo`. ```javascript my.chooseImage({ success: (res) => { console.log(res.apFilePaths[0], 1212); my.saveFile({ apFilePath: res.apFilePaths[0], success: (result) => { console.log(result, 1212); my.getSavedFileInfo({ apFilePath: result.apFilePath, success: (resu) => { console.log(JSON.stringify(resu)); } }); }, }); }, }); ``` -------------------------------- ### Run Backend Server (Go) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Start the Go backend server for the Super Qi Demo Miniapp. Ensure the .env file is configured correctly. ```bash go run main.go ``` -------------------------------- ### Run Backend Server (Node.js) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Start the Node.js backend server for the Super Qi Demo Miniapp. Ensure the .env file is configured correctly. ```bash npm run dev ``` -------------------------------- ### Callback Payload Example (Customer User) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Example of the callback payload when the user is a customer. ```json { "language": "en-US", "isProdEnv": "true", "currentRole": "customer", "systemInfo": "Android 15", "hardwareInfo": "HONOR_PGT-AN00", "loginTime": "360307579" } ``` -------------------------------- ### Navigate to Project Directory Source: https://superqi-dev-docs.pages.dev/llms-full.txt Change the current directory to the cloned Super Qi Demo Miniapp project folder. ```bash cd superqi-demo-miniapp ``` -------------------------------- ### Navigate to Frontend Directory Source: https://superqi-dev-docs.pages.dev/llms-full.txt Change the current directory to the frontend of the Super Qi Demo Miniapp. ```bash cd superqi-demo-miniapp/frontend ``` -------------------------------- ### Apply Token using Go Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/authorization/apply-token Illustrates how to apply a token using Go's standard library for HTTP requests. This is useful for Go-based services. ```go package main import ( "bytes" "encoding/json" "fmt" "log" "net/http" ) func main() { token := "your-token-here" url := "http://localhost:8080/v1/apply-token" payload := map[string]string{"token": token} payloadBytes, err := json.Marshal(payload) if err != nil { log.Fatalf("Error marshaling JSON: %v", err) } resp, err := http.Post(url, "application/json", bytes.NewBuffer(payloadBytes)) if err != nil { log.Fatalf("Error making POST request: %v", err) } defer resp.Body.Close() var result map[string]interface{} if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { log.Fatalf("Error decoding response: %v", err) } fmt.Println(result) } ``` -------------------------------- ### TradePay Success Callback Payload Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt Example of the payload received in the success callback for tradePay, indicating the payment outcome. ```json { "resultCode": "9000" } ``` -------------------------------- ### ApplyToken Request Body Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt This is an example of a request body for the applyToken API, specifying grant type and authorization code. ```json { "grantType": "AUTHORIZATION_CODE", "authCode": "2810111301lGzcM9CjlF91WH00039190xxxx" } ``` -------------------------------- ### Initiate Payment (JavaScript) Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/payments/pay Example of how to initiate a payment using the payment API. This snippet demonstrates the basic structure for sending payment details. ```javascript use strict"; (function() { const t = window; const e = document.documentElement; const c = ["dark", "light"]; const n = getStorageValue("localStorage", "nuxt-color-mode") || "system"; let i = n === "system" ? u() : n; const r = e.getAttribute("data-color-mode-forced"); if (r) { i = r; } l(i); t.__NUXT_COLOR_MODE__ = { preference: n, value: i, getColorScheme: u, addColorScheme: l, removeColorScheme: d }; function l(o) { const s = "" + o + ""; const a = ""; if (e.classList) { e.classList.add(s); } else { e.className += " " + s; } if (a) { e.setAttribute("data-" + a, o); } } function d(o) { const s = "" + o + ""; const a = ""; if (e.classList) { e.classList.remove(s); } else { e.className = e.className.replace(new RegExp(s, "g"), ""); } if (a) { e.removeAttribute("data-" + a); } } function f(o) { return t.matchMedia("(prefers-color-scheme" + o + ")"); } function u() { if (t.matchMedia && f("").media !== "not all") { for (const o of c) { if (f(":" + o).matches) { return o; } } } return "light"; } })(); function getStorageValue(t, e) { switch (t) { case "localStorage": return window.localStorage.getItem(e); case "sessionStorage": return window.sessionStorage.getItem(e); case "cookie": return getCookie(e); default: return null; } } function getCookie(t) { const c = ("; " + window.document.cookie).split("; " + t + "="); if (c.length === 2) { return c.pop()?.split(";").shift(); } } ``` -------------------------------- ### Confirm Order Response Example (Success) Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/payments/confirm-order Example of a successful response when an order is confirmed. It includes the order ID, status, and confirmation details. ```json { "orderId": "ord_12345abcde", "status": "CONFIRMED", "confirmation": { "transactionId": "txn_abcdef12345", "timestamp": "2023-10-27T10:30:00Z" }, "message": "Order has been successfully confirmed." } ``` -------------------------------- ### Get Information About a Locally Chosen Image Source: https://superqi-dev-docs.pages.dev/llms-full.txt After choosing an image with `my.chooseImage`, use `my.getImageInfo` with the returned `apFilePaths` to get details about the selected local image. ```javascript // apFilePath from chooseImage my.chooseImage({ success: (res) => { my.getImageInfo({ src: res.apFilePaths[0], success: (res) => { console.log(JSON.stringify(res)); } }); }, }); ``` -------------------------------- ### Initialize Color Mode Management Source: https://superqi-dev-docs.pages.dev/api-reference/jsapi/file-apis/get-saved-file-info Sets up the color mode management system, reading from local storage or system preferences, and applying the initial theme. ```javascript use strict"; (()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n; const r=e.getAttribute("data-color-mode-forced"); r&&(i=r), l(i), t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d}; function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)} function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)} function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")} function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o} return"light"}})(); ``` -------------------------------- ### Go Example: Handling Webhook with Signature Validation Source: https://superqi-dev-docs.pages.dev/llms-full.txt Demonstrates how to integrate the `SignatureValidator` into an HTTP handler. Ensure the public key path is correctly configured. ```go func handleWebhook(w http.ResponseWriter, r *http.Request) { validator, err := NewSignatureValidator("path/to/superqi_public_key.pem") if err != nil { http.Error(w, "Server configuration error", 500) return } err = validator.ValidateWebhook(r, "/api/payment/webhook") if err != nil { log.Printf("Invalid signature: %v", err) http.Error(w, "Invalid signature", 401) return } // Signature is valid - safe to process webhook // ... process payment notification } ``` -------------------------------- ### Get Information About an Image Using a Relative Path Source: https://superqi-dev-docs.pages.dev/llms-full.txt Use `my.getImageInfo` to get details about an image located at a relative path within the application's assets. ```javascript // Relative path my.getImageInfo({ src: 'image/api.png', success: (res) => { console.log(JSON.stringify(res)); } }); ``` -------------------------------- ### Create .env File for Backend (Go) Source: https://superqi-dev-docs.pages.dev/llms-full.txt Create an empty .env file in the backend-go directory. This file will store environment-specific variables for the backend. ```bash cd superqi-demo-miniapp/backend-go touch .env ``` -------------------------------- ### Confirm Order Response Example (Error) Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/payments/confirm-order Example of an error response when attempting to confirm an order that has already been confirmed or is in an invalid state. Includes an error code and message. ```json { "orderId": "ord_12345abcde", "status": "FAILED", "error": { "code": "ORDER_ALREADY_CONFIRMED", "message": "This order has already been confirmed." } } ``` -------------------------------- ### Install Node.js with nvm on macOS/Linux Source: https://superqi-dev-docs.pages.dev/llms-full.txt Install Node.js version 18 using nvm (Node Version Manager) on macOS or Linux. nvm is recommended for managing Node.js versions. ```bash # Install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash # Restart terminal, then install Node.js nvm install 18 nvm use 18 ``` -------------------------------- ### Initiating and Aborting a Request with my.request Source: https://superqi-dev-docs.pages.dev/llms-full.txt This example shows how to initiate an HTTP request using `my.request` and obtain a task object that can be used to abort the request before it completes. This is useful for cancelling ongoing network operations. ```javascript const task = my.request({url: 'https://httpbin.org/post'}); task.abort(); ``` -------------------------------- ### Token Refresh Request Example Source: https://superqi-dev-docs.pages.dev/llms-full.txt This is an example of a POST request to the /v1/authorizations/applyToken endpoint to refresh an expired access token using a refresh token. Ensure the grantType is set to REFRESH_TOKEN. ```http POST /v1/authorizations/applyToken Content-Type: application/json { "grantType": "REFRESH_TOKEN", "refreshToken": "2810110033AAB2F588D14B43238637264FCA5AAF35xxxx" } ``` -------------------------------- ### Mini App Initialization Script Source: https://superqi-dev-docs.pages.dev/developers-guide/getting-started/what-are-miniapps This script initializes the Mini App environment, handling theme management and exposing essential functions to the window object. It manages color schemes based on user preferences or system settings. ```javascript use strict"; (function(){ const t = window; const e = document.documentElement; const c = ["dark", "light"]; const n = getStorageValue("localStorage", "nuxt-color-mode") || "system"; let i = n === "system" ? getSystemColorScheme() : n; const r = e.getAttribute("data-color-mode-forced"); if (r) { i = r; } applyColorScheme(i); t.__NUXT_COLOR_MODE__ = { preference: n, value: i, getColorScheme: getSystemColorScheme, addColorScheme: applyColorScheme, removeColorScheme: removeColorScheme }; function applyColorScheme(o) { const s = "" + o + ""; const a = ""; // Potentially for data attributes, not used in this snippet if (e.classList) { e.classList.add(s); } else { e.className += " " + s; } if (a) { e.setAttribute("data-" + a, o); } } function removeColorScheme(o) { const s = "" + o + ""; const a = ""; // Potentially for data attributes, not used in this snippet if (e.classList) { e.classList.remove(s); } else { e.className = e.className.replace(new RegExp(s, "g"), ""); } if (a) { e.removeAttribute("data-" + a); } } function prefersColorScheme(o) { return t.matchMedia("(prefers-color-scheme" + o + ")"); } function getSystemColorScheme() { if (t.matchMedia && prefersColorScheme("").media !== "not all") { for (const o of c) { if (prefersColorScheme(":" + o).matches) { return o; } } } return "light"; // Default to light if system preference cannot be determined } })(); function getStorageValue(storageType, key) { switch (storageType) { case "localStorage": return window.localStorage.getItem(key); case "sessionStorage": return window.sessionStorage.getItem(key); case "cookie": return getCookie(key); default: return null; } } function getCookie(key) { const c = ("; " + window.document.cookie).split("; " + key + "="); if (c.length === 2) { return c.pop()?.split(";").shift(); } } ``` -------------------------------- ### Import the SDK Source: https://superqi-dev-docs.pages.dev/llms-full.txt Include this script tag in your Mini Program's HTML to access the Super Qi SDK. ```html ``` -------------------------------- ### Pay Request Body Example (Cashier Payment) Source: https://superqi-dev-docs.pages.dev/llms-full.txt This example shows the request body structure for a pay API call, including product code, payment details, and order information. ```json { "productCode": "51051000101000000011", "paymentRequestId": "UDQzzvxwvyvUDxGqhMHUlIBpGkydOQC6", "paymentAmount": { "currency": "IQD", "value": "116000" }, "order": { "orderDescription": "order_description", "buyer": { "referenceBuyerId": "216610000000003660xxxx" } }, "paymentNotifyUrl": "https://www.merchant.com/paymentNotify" } ``` -------------------------------- ### Apply Token using Python Source: https://superqi-dev-docs.pages.dev/api-reference/open-apis/authorization/apply-token Provides an example of applying a token using Python's 'requests' library. This is a common method for backend integrations. ```python import requests import json def apply_token(token): url = 'http://localhost:8080/v1/apply-token' headers = {'Content-Type': 'application/json'} payload = {'token': token} response = requests.post(url, headers=headers, data=json.dumps(payload)) print(response.json()) apply_token('your-token-here') ```