Skip to content
alxspiker edited this page Feb 24, 2024 · 1 revision

AuthResult Object

This document outlines the structure of the PaymentDTO object returned by Pi Network API calls related to payments.

Data Structure

type AuthResult = {
  accessToken: string,
  user: {
    uid: string,
    username: string
  }
}

PaymentDTO Object

This document outlines the structure of the PaymentDTO object returned by Pi Network API calls related to payments.

Data Structure

type PaymentDTO = {
  // Payment data:
  "identifier": string, // The unique payment identifier
  "Pioneer_uid": string, // The Pioneer's app-specific ID
  "amount": number, // The payment amount
  "memo": string, // A developer-provided string, shown to the Pioneer
  "metadata": Object, // An object for developer-specific data
  "to_address": string, // The recipient's blockchain address
  "created_at": string, // Timestamp of payment creation

  // Status flags:
  "status": {
    "developer_approved": boolean, // Server-side approval status
    "transaction_verified": boolean, // Blockchain transaction verification status
    "developer_completed": boolean, // Server-side completion status
    "canceled": boolean, // Canceled by the developer or Pi Network
    "Pioneer_cancelled": boolean, // Canceled by the Pioneer
  },

  // Blockchain transaction data (populated if a transaction exists):
  "transaction": null | { 
    "txid": string, // The blockchain transaction ID
    "verified": boolean, // True if the transaction matches the payment
    "_link": string, // A link to the operation on the Blockchain API
  },
};

UserDTO Object

This document defines the structure of the UserDTO object returned by Pi Network API endpoints that provide Pioneer information.

Data Structure

type UserDTO = {
  "uid": string, // A unique, app-specific identifier for the Pioneer.
  "username": string, // The Pioneer's Pi Network username (requires the 'username' scope).
}