@slashfi/elements
v0.0.1
Published
Client SDK for confirming a Slash PaymentIntent.
Keywords
Readme
@slashfi/elements
Framework-agnostic public contracts for confirming a Slash PaymentIntent. The vanilla client is not implemented yet.
React merchants should use
@slashfi/elements-react,
which provides PaymentProvider, PaymentElement, BrandingElement, and
usePaymentElements() on top of these shared contracts.
The PaymentIntent creation and client-secret routes required by the proposed SDK flow are not yet part of the published Slash API.
The React SDK confirms Whop-backed intents through
POST /acquiring/client/whop/confirm. A successful response requires
nextAction: { whopClientSecret: string }. Whop Elements consumes the client
secret. After a failed or dismissed buyer step, the server checks the current
authorization and fetches fresh Whop status outside the transaction, then locks
and rechecks that the same payment still owns the intent. Whop canceled,
requires_action, or requires_confirmation with a non-null last_payment_error
permits release for retry. Redirects, other provider statuses, and API errors
never release.
The low-level confirm request requires name and stateHash. The React SDK
sends the merchant-collected cardholder name and the hash returned by bootstrap.
PaymentResult returns either error or processing (buyer done or redirected,
not a settlement guarantee). Validation, payment, request, and API failures
are returned as structured PaymentError values.
const result = await paymentState.confirm({ email, name, billingAddress });
if (result.type === 'error') {
showCheckoutError(result.error.message);
} else {
redirectToProcessingPage(result.paymentIntentId);
}The React SDK calls handleNextAction sequentially with a 500ms delay between
polls and no total timeout. It waits through confirming and
requires_confirmation without a payment error. succeeded, processing, and
requires_capture complete the buyer step; capture/settlement remains server-side.
Failures and dismissed modals use server-verified release: pending permits
retry, while any other status remains non-retryable. A redirect never releases.
See the React README for the full flow.
