@vetaui/payments-kit
v0.1.2
Published
Veta payments — provider-agnostic checkout abstraction with adapters for MercadoPago, Stripe, Yape, Plin + UI components.
Maintainers
Readme
@vetaui/payments-kit
LATAM-first payment integration for Veta. One unified checkout API for MercadoPago, Stripe, Yape, and Plin — two lines of code, any provider.
Install
pnpm add @vetaui/foundations @vetaui/atoms @vetaui/payments-kitAdd the provider SDK you need:
pnpm add mercadopago # MercadoPago
pnpm add stripe # StripeSetup
// app/providers.tsx
import { configureVeta } from "@vetaui/foundations/runtime";
import { mercadoPago } from "@vetaui/payments-kit";
configureVeta({
payments: mercadoPago({ accessToken: process.env.MP_ACCESS_TOKEN! }),
});Checkout button
import { createCheckout } from "@vetaui/payments-kit";
import { CheckoutPage } from "@vetaui/payments-kit/screens";
<CheckoutPage
items={[
{
id: "plan-pro",
name: "Pro Plan",
quantity: 1,
price: { amount: 29, currency: "USD" },
},
]}
methods={["card", "yape", "plin"]}
onPlaceOrder={async ({ items, method }) => {
const session = await createCheckout({
reference: crypto.randomUUID(),
items,
method,
successUrl: "https://app.example.com/billing/success",
cancelUrl: "https://app.example.com/billing/cancel",
});
window.location.href = session.url;
}}
/>;Wallet settlement lookup
Yape and Plin integrations normally reconcile through your own backend
settlement/webhook store. Pass lookupCharge so Veta screens can read the real
charge state instead of the deterministic pending fallback:
import { yape } from "@vetaui/payments-kit/providers";
export const payments = yape({
merchantPhone: process.env.YAPE_PHONE!,
merchantName: "Veta Store",
lookupCharge: async (id) => db.walletCharges.findById(id),
});Money utilities
import { formatMoney, addMoney, mulMoney } from "@vetaui/payments-kit";
formatMoney({ amount: 2900, currency: "ARS" }); // → "$ 2.900"
formatMoney({ amount: 29, currency: "USD" }); // → "$29.00"Supported providers
| Provider | Currency | Region | | ----------- | --------------------------------- | ------ | | MercadoPago | ARS / BRL / CLP / COP / MXN / PEN | LATAM | | Stripe | USD / EUR / GBP + 130 more | Global | | Yape | PEN | Peru | | Plin | PEN | Peru |
Exports
| Export | Description |
| ------------------------ | ------------------------------------------------------------- |
| PaymentButton | Checkout button — handles redirect / modal per provider |
| CheckoutPage | Drop-in cart → shipping → payment → review flow |
| BillingHistory | Import from @vetaui/payments-kit/screens for invoice tables |
| SubscriptionManagement | Import from @vetaui/payments-kit/screens for billing settings |
| mercadoPago | MercadoPago provider factory |
| stripeProvider | Stripe provider factory |
| yape | Yape provider factory |
| plin | Plin provider factory |
| formatMoney | Locale-aware money formatter |
| addMoney | Safe money addition (avoids floating-point) |
| mulMoney | Safe money multiplication |
License
MIT — Dambert Munoz
