Skip to content

Class: PaymentsResource

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

Constructors

Constructor

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

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

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:100

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:75

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:144

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:80

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:95

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;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "received" | "sent";
  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?: "delivered" | "new" | "read";
  to_agent_id?: string | null;
  type: string;
}>;

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

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; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "received" | "sent"; 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?: "delivered" | "new" | "read"; to_agent_id?: string | null; type: string; }>


sendReceipt()

sendReceipt(
   payment, 
   settlement, 
   opts?): Promise<{
  content_type?: string | null;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "received" | "sent";
  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?: "delivered" | "new" | "read";
  to_agent_id?: string | null;
  type: string;
}>;

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

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; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "received" | "sent"; 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?: "delivered" | "new" | "read"; to_agent_id?: string | null; type: string; }>


setPolicy()

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

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

Persist the acting agent's spend policy (validated before write).

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:131

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:123

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:70

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>