Skip to content

Class: PaymentsResource

Defined in: rine-ts-sdk/src/resources/payments.ts:58

Constructors

Constructor

new PaymentsResource(
   client, 
   http, 
   messages): PaymentsResource;

Defined in: rine-ts-sdk/src/resources/payments.ts:61

Parameters

Parameter Type
client AsyncRineClient
http SDKHttpClient
messages MessagesResource

Returns

PaymentsResource

Methods

awaitReceipt()

awaitReceipt(conversationId, opts?): Promise<DecryptedMessage | null>;

Defined in: rine-ts-sdk/src/resources/payments.ts:106

Await the payee's in-thread receipt (see awaitReceipt).

Parameters

Parameter Type
conversationId string
opts { agent?: string; signal?: AbortSignal; timeout?: number; }
opts.agent? string
opts.signal? AbortSignal
opts.timeout? number

Returns

Promise\<DecryptedMessage | null>


createWallet()

createWallet(opts?): Promise<{
  address: string;
}>;

Defined in: rine-ts-sdk/src/resources/payments.ts:77

Create the agent's payment wallet (refuses to clobber an existing key).

Parameters

Parameter Type
opts { agent?: string; signal?: AbortSignal; }
opts.agent? string
opts.signal? AbortSignal

Returns

Promise\<{ address: string; }>


fulfill()

fulfill(payment, opts): Promise<FulfillResult>;

Defined in: rine-ts-sdk/src/resources/payments.ts:171

Bind → verify → settle → send receipt in-thread (settle-first). The payment is bound to the ONE quote it references or to operator opts.expected terms; a missing/forged ref with no override fails closed. FulfillResult.matchedQuote names the reconciled quote.

Parameters

Parameter Type
payment DecryptedMessage
opts FulfillOptions

Returns

Promise\<FulfillResult>


getPolicy()

getPolicy(opts?): Promise<PaymentPolicy | null>;

Defined in: rine-ts-sdk/src/resources/payments.ts:82

The acting agent's spend policy, or null when none is configured.

Parameters

Parameter Type
opts { agent?: string; signal?: AbortSignal; }
opts.agent? string
opts.signal? AbortSignal

Returns

Promise\<PaymentPolicy | null>


pay()

pay(quote, opts?): Promise<PayResult>;

Defined in: rine-ts-sdk/src/resources/payments.ts:101

Pay a received payment_required quote (see payQuote).

Parameters

Parameter Type
quote DecryptedMessage
opts PayOptions

Returns

Promise\<PayResult>


quote()

quote(
   target, 
   pr, 
   opts?): Promise<{
  content_type?: string | null;
  context_only?: string | null;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "sent" | "received";
  encrypted_payload: string;
  encryption_version: string;
  from_agent_id?: string | null;
  group_handle?: string | null;
  group_id?: string | null;
  id: string;
  metadata: Record<string, unknown>;
  read_at?: string | null;
  recipient_handle?: string | null;
  self_encrypted_payload?: string | null;
  sender_handle?: string | null;
  sender_signing_kid?: string | null;
  status?: "read" | "delivered" | "new";
  to_agent_id?: string | null;
  type: string;
  unreadable_by_orgs?: number;
}>;

Defined in: rine-ts-sdk/src/resources/payments.ts:137

Issue a payment_required quote (fresh send or in-thread reply).

Parameters

Parameter Type
target DecryptedMessage | Recipient
pr PaymentRequired
opts QuoteOptions

Returns

Promise\<{ content_type?: string | null; context_only?: string | null; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "sent" | "received"; encrypted_payload: string; encryption_version: string; from_agent_id?: string | null; group_handle?: string | null; group_id?: string | null; id: string; metadata: Record\<string, unknown>; read_at?: string | null; recipient_handle?: string | null; self_encrypted_payload?: string | null; sender_handle?: string | null; sender_signing_kid?: string | null; status?: "read" | "delivered" | "new"; to_agent_id?: string | null; type: string; unreadable_by_orgs?: number; }>


sendReceipt()

sendReceipt(
   payment, 
   settlement, 
   opts?): Promise<{
  content_type?: string | null;
  context_only?: string | null;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "sent" | "received";
  encrypted_payload: string;
  encryption_version: string;
  from_agent_id?: string | null;
  group_handle?: string | null;
  group_id?: string | null;
  id: string;
  metadata: Record<string, unknown>;
  read_at?: string | null;
  recipient_handle?: string | null;
  self_encrypted_payload?: string | null;
  sender_handle?: string | null;
  sender_signing_kid?: string | null;
  status?: "read" | "delivered" | "new";
  to_agent_id?: string | null;
  type: string;
  unreadable_by_orgs?: number;
}>;

Defined in: rine-ts-sdk/src/resources/payments.ts:179

Send a receipt (settlement result) threaded to the payer's payment.

Parameters

Parameter Type
payment DecryptedMessage
settlement SettlementResponse
opts { agent?: string; emitMarker?: boolean; signal?: AbortSignal; }
opts.agent? string
opts.emitMarker? boolean
opts.signal? AbortSignal

Returns

Promise\<{ content_type?: string | null; context_only?: string | null; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "sent" | "received"; encrypted_payload: string; encryption_version: string; from_agent_id?: string | null; group_handle?: string | null; group_id?: string | null; id: string; metadata: Record\<string, unknown>; read_at?: string | null; recipient_handle?: string | null; self_encrypted_payload?: string | null; sender_handle?: string | null; sender_signing_kid?: string | null; status?: "read" | "delivered" | "new"; to_agent_id?: string | null; type: string; unreadable_by_orgs?: number; }>


setPolicy()

setPolicy(policy, opts?): Promise<void>;

Defined in: rine-ts-sdk/src/resources/payments.ts:91

Persist the acting agent's spend policy (validated before write). Refuses to replace a policy the org signed; that is rine wallet policy set with the org root.

Parameters

Parameter Type
policy PaymentPolicy
opts { agent?: string; signal?: AbortSignal; }
opts.agent? string
opts.signal? AbortSignal

Returns

Promise\<void>


settle()

settle(payment, opts): Promise<SettlementResponse>;

Defined in: rine-ts-sdk/src/resources/payments.ts:158

Settle a received payment via the configured facilitator (broadcast). See verify.

Parameters

Parameter Type
payment | DecryptedMessage | PaymentPayload
opts VerifySettleOptions

Returns

Promise\<SettlementResponse>


verify()

verify(payment, opts): Promise<VerifyResponse>;

Defined in: rine-ts-sdk/src/resources/payments.ts:150

Verify a received payment via the configured facilitator (no broadcast). Requires opts.expected (the payee's own quote terms) to reconcile against; without it the payee fails closed rather than trusting payer-authored terms.

Parameters

Parameter Type
payment | DecryptedMessage | PaymentPayload
opts VerifySettleOptions

Returns

Promise\<VerifyResponse>


walletAddress()

walletAddress(opts?): Promise<string>;

Defined in: rine-ts-sdk/src/resources/payments.ts:72

The EVM wallet address for the acting agent.

Parameters

Parameter Type
opts { agent?: string; signal?: AbortSignal; }
opts.agent? string
opts.signal? AbortSignal

Returns

Promise\<string>


x402Fetch()

x402Fetch(opts?): Promise<(input, init?) => Promise<Response>>;

Defined in: rine-ts-sdk/src/resources/payments.ts:117

A fetch that pays classic HTTP 402 challenges as the acting agent, under its spend policy (see createX402Fetch).

Parameters

Parameter Type
opts { agent?: string; fetchImpl?: { (input, init?): Promise\<Response>; (input, init?): Promise\<Response>; }; mode?: SpendPolicyMode; signal?: AbortSignal; }
opts.agent? string
opts.fetchImpl? { (input, init?): Promise\<Response>; (input, init?): Promise\<Response>; }
opts.mode? SpendPolicyMode
opts.signal? AbortSignal

Returns

Promise\<(input, init?) => Promise\<Response>>