Specialized skill for working with checkout and payment systems including MercadoPago integration, order management, address validation, and checkout flow. Use when implementing checkout improvements, integrating payment methods, debugging payment issues, or optimizing checkout process.
When working with checkout:
src/app/checkout/ - Checkout pagessrc/components/Checkout/ - Checkout componentssrc/lib/integrations/mercadopago/ - MercadoPago integrationsrc/lib/business/orders/ - Order logicsrc/hooks/useCheckout.ts - Checkout hookimport { createOrder } from '@/lib/business/orders/order-service';
import { createPayment } from '@/lib/integrations/mercadopago';
export async function POST(request: NextRequest) {
const { items, shippingAddress, paymentMethod } = await request.json();
const order = await createOrder({
items,
shippingAddress,
status: 'pending_payment',
});
const payment = await createPayment({
transaction_amount: order.total,
description: `Orden #${order.id}`,
payer: {
email: order.customer_email,
},
});
await updateOrder(order.id, {
payment_id: payment.id,
payment_status: 'pending',
});
return NextResponse.json({ order, payment });
}
import { validateAddress } from '@/lib/business/logistics/address-validation';
const validation = await validateAddress({
street: 'Av. Corrientes 1234',
city: 'Buenos Aires',
postalCode: 'C1043AAX',
country: 'AR',
});
if (!validation.isValid) {
return { errors: validation.errors };
}
import { initMercadoPago, Wallet } from '@mercadopago/sdk-react';
function CheckoutPayment() {
const [paymentData, setPaymentData] = useState(null);
useEffect(() => {
initMercadoPago('YOUR_PUBLIC_KEY');
}, []);
return (
<Wallet
initialization={{ preferenceId: paymentData?.preference_id }}
onSubmit={onSubmit}
/>
);
}
pending_payment - Waiting for paymentpaid - Paidprocessing - Processingshipped - Shippeddelivered - Deliveredcancelled - Cancelledrefunded - Refunded