/api/v1/payment_intents

The endpoint will return all payment intents created related to the access_token creator.

The Payment Intents object is defined as a typescript interface

interface PaymentIntent_ApiV1 {
  id: number; // The number identifier of the payment intent
  created_at: string; // The UTC string date when it was created
  account: Account_ApiV1; // See /api/v1/accounts for the Accounts object
  payee_address: string; // The address that will receive the payments 
  max_debit_amount: string; // The max debitable amount 
  debit_times: number; // The amount of times the payment intent can be used
  debit_interval: number; // The interval of days the payment intent can be used
  payment_intent: string; // The payment intent identifier,same as the Checkout Redirect , this represents the payment intent on-chain!
  commitment: string; // The account commitment
  estimated_gas: string; // The estimated gas cost to relay a single transaciton
  status_text: PaymentIntentStatus_ApiV1; // The Status of the payment intent, an enum
  last_payment_date: string | null; // UTC string
  next_payment_date: string | null; // UTC string
  pricing: Pricing_ApiV1; // "Fixed" or "Dynamic"
  currency: Currency_ApiV1; // The currency is composed of 
  network: Network_ApiV1;  // See below the interface
  debit_item: DebitItem_ApiV1; // The the debit item object the payment intents are derived from
  used_for: number; // how many times the payment intent was used already
  transactions_left: number; // calulated like: debit_interval - used_for
  failed_dynamic_payment_amount: string; //If dynamic payment was requested but it failed because account balance too low, the missing amount is returned here
}

interface Currency_ApiV1 {
  name: string; // The name of the currency
  native: boolean; // is it a native token , if true then contract address is an empty string
  contractAddress: string; // The contract address
}

interface Network_ApiV1 {
  name: string; // The name of the current network
  rpc: string; // The RPC url used for accessing the network
  chain_id: string; // The chain id as a hex string
  currency: string; // The ticker of the currency
  virtual_accounts_contract: string; // The address  of the virtual accounts contract on this chain
  connected_wallets_contract: string; // The address of the connected wallets contarct on this chain
  available_currencies: Array<Currency_ApiV1>; // The currencies currently supported on this network
}
enum PaymentIntentStatus_ApiV1 {
  CREATED = "CREATED", // The payment intent was just created, it's ready for the first transction
  CANCELLED = "CANCELLED", // The payment intent was cancelled, requires a wallet signed transaciton from it's creator or the payee
  RECURRING = "RECURRING", // The subsciptions are in progress and waiting for the next payment
  PAID = "PAID", // The subsciption period is over, the paymetns finished
  ACCOUNTBALANCETOOLOW = "ACCOUNTBALANCETOOLOW", // The payments are stuck because the account balance is too low
}

interface DebitItem_ApiV1 {
  id: number; // The id of the debit item
  created_at: string; // The UTC date string when the item was created
  payee_address: string; // The address that will receive the payments
  currency: Currency_ApiV1; // The currency used for this item
  max_price: string; // The maximum price that can be debited
  debit_times: number; // The amount of subsciption payments
  debit_interval: number; // The interval of subscription payments per days
  button_id: string; // The uuid of the button, used for accessing the checkout!
  redirect_url: string; // The url where the checkout will redirect to!
  pricing: Pricing_ApiV1; // The pricing "Fixed" or "Dynamic"
  network: Network_ApiV1; // The network this debit item supports
  name: string; // The name of the item is the name of the subsciption or payment intent
  deleted: boolean; // The items can be deleted to disable the checkout. It's possible to reactive them afterwards
  payment_intents_count: number; // The amount of payment intents created for this debit item, is the count of subsciptions created
}

Pagination

When fetching payment intents with pagination, they can be sorted using these sort_by values

Here shown, as internally stored, as a Typescript enum:

 enum PaymentIntents_sortyBy {
  created_at = "created_at",
  payee_address = "payee_address",
  max_debit_amount = "max_debit_amount",
  debit_times = "debit_times",
  debit_interval = "debit_interval",
  payment_intent = "payment_intent",
  status_text = "status_text",
  estimated_gas = "estimated_gas",
  last_payment_date = "last_payment_date",
  next_payment_date = "next_payment_date",
  pricing = "pricing",
  currency = "currency",
  debit_item_id = "debit_item_id",
}

Filtering

You can request to filter the responses using the filter query parameter which must contain a JSON string! See the below pseudo code:

const filter = JSON.stringify({
  payee_address : string, // The address that will receive the payment
  max_debit_amount : string, // The maximum amount the payment intent can be used for
  debit_times : number, // The amount of times the payment intent can be used
  debit_interval : number, // A number that represents days
  status_text : PaymentIntentStatus_ApiV1, // See the enum bellow for possible values
  pricing : Pricing, // See the enum below for possible values
  currency : string, // Must be JSON string
  debit_item_id : number, // The integer id of the debit_item
  });

 enum Pricing_ApiV1 {
  Fixed = "Fixed", 
  Dynamic = "Dynamic",
}
  

All the parameters for filtering are optional, just like the pagination.

Last updated