Make a payment
Record a validated-recipient payment through the Core SDK.
client.payments.pay
Record a validated-recipient payment through the Core SDK.
Limited availability
Only some variants of this operation are implemented. Check the limitations before integrating it.
Import and client prerequisite
import { createCapxulClient } from "@capxul/sdk";
const created = await createCapxulClient({
publishableKey: "cap_pk_…",
});
if (!created.ok) throw created.error;
const client = created.value;Usage
const result = await client.payments.pay({
to: { kind: "email", email: "recipient@example.com" },
amount: { currency: "USD", value: "25.00", decimals: 6 },
});
if (!result.ok) {
console.error(result.error.code);
return;
}
console.log(result.value.id);Signature
client.payments.pay(input: PaymentsPayInput, options?: { readonly signal?: AbortSignal; }): Promise<CapxulResult<Payment>>;Source: packages/sdk/src/surface/money.ts:861.
Parameters
input
Required.
PaymentsPayInput;Prop
Type
options
Optional.
{ readonly signal?: AbortSignal; } | undefinedto is a typed recipient reference. The kind field selects the variant;
the other field carries its value:
{ kind: "handle", handle: string }{ kind: "email", email: string }{ kind: "organization", handle: string }{ kind: "payee", id: string }
The shared TargetReference union also contains
{ kind: "destination", id: string }, but payments.pay returns
NOT_IMPLEMENTED for that variant. A bare EVM address is rejected with
INVALID_INPUT.
Only the personal actor is implemented. An Organization actor returns
NOT_IMPLEMENTED.
Pass the payment intent only. The SDK owns the request key lifecycle. Returned
payments include actor-relative direction, counterpartyLabel, and a nullable
settled receipt.
Returns
Promise<CapxulResult<Payment>>;Read the ok discriminant before accessing value or error.
Errors
Expected failures resolve as { ok: false, error: CapxulError }; they are not thrown as the normal domain contract. Branch on result.ok and use the stable error.code. A pre-aborted AbortSignal returns a CANCELLED failure. Provider messages and internal causes are not public contracts.
Availability and evidence
Limited availability. Evidence classification: shipped-proven.
shipped-proven at the typed or hermetic Core SDK contract boundary. Personal-actor paths have implementation and hermetic proof. An Organization actor and a destination target currently return NOT_IMPLEMENTED; do not infer live settlement from a successful pending record.
Related
- React SDK equivalent:
useCapxulPay - Platform capability matrix
- Core SDK scaffold inventory
- Result and proof boundaries