/vtex-ai-skills:payment-provider-protocolfrom vtex-ai-skills
Implements VTEX Payment Provider Protocol (PPP) connectors covering all nine required endpoints: Manifest, Create Payment, Cancel, Capture/Settle, Refund, Inbound Request, Create Auth Token, Provider Auth Redirect, and Get Credentials. Use for building or debugging payment connectors that integrate with the VTEX Payment Gateway.
Ships in vtex-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill when:
Do not use this skill for:
payment-idempotencypayment-async-flowpayment-pci-securityVenda Direta Credito, Venda Direta Debito, terminal Payment Apps) — use payment-ppp-pos together with this skill for endpoint shapescallbackUrl (async notifications) and Secure Proxy (card data forwarding).The connector MUST implement all six payment-flow endpoints: GET /manifest, POST /payments, POST /payments/{paymentId}/cancellations, POST /payments/{paymentId}/settlements, POST /payments/{paymentId}/refunds, and POST /payments/{paymentId}/inbound-request/{action}.
Why this matters The VTEX Payment Provider Test Suite validates every endpoint during homologation. Missing endpoints cause test failures and the connector will not be approved. At runtime, the Gateway expects all endpoints — a missing cancel endpoint means payments cannot be voided.
Detection If the connector router/handler file does not define handlers for all 6 payment-flow paths, STOP and add the missing endpoints before proceeding.
Correct
import { Router } from "express";
const router = Router();
// All 6 payment-flow endpoints implemented
router.get("/manifest", manifestHandler);
router.post("/payments", createPaymentHandler);
router.post("/payments/:paymentId/cancellations", cancelPaymentHandler);
router.post("/payments/:paymentId/settlements", capturePaymentHandler);
router.post("/payments/:paymentId/refunds", refundPaymentHandler);
router.post("/payments/:paymentId/inbound-request/:action", inboundRequestHandler);
export default router;
Wrong
import { Router } from "express";
const router = Router();
// Missing manifest, inbound-request, and refund endpoints
// This will fail homologation and break runtime operations
router.post("/payments", createPaymentHandler);
router.post("/payments/:paymentId/cancellations", cancelPaymentHandler);
router.post("/payments/:paymentId/settlements", capturePaymentHandler);
export default router;
Each endpoint MUST return the exact response shape documented in the PPP API. Create Payment MUST return paymentId, status, authorizationId, tid, nsu, acquirer, code, message, delayToAutoSettle, delayToAutoSettleAfterAntifraud, and delayToCancel. Cancel MUST return paymentId, cancellationId, code, message, requestId. Capture MUST return paymentId, settleId, value, code, message, requestId. Refund MUST return paymentId, refundId, value, code, message, requestId.
Why this matters
The Gateway parses these fields programmatically. Missing fields cause deserialization errors and the Gateway treats the payment as failed. Incorrect delayToAutoSettle values cause payments to auto-cancel or auto-capture at wrong times.
Detection If a response object is missing any of the required fields for its endpoint, STOP and add the missing fields.
Correct
interface CreatePaymentResponse {
paymentId: string;
status: "approved" | "denied" | "undefined";
authorizationId: string | null;
nsu: string | null;
tid: string | null;
acquirer: string | null;
code: string | null;
message: string | null;
delayToAutoSettle: number;
delayToAutoSettleAfterAntifraud: number;
delayToCancel: number;
paymentUrl?: string;
}
async function createPaymentHandler(req: Request, res: Response): Promise<void> {
const { paymentId, value, currency, paymentMethod, card, callbackUrl } = req.body;
const result = await processPaymentWithAcquirer(req.body);
const response: CreatePaymentResponse = {
paymentId,
status: result.status,
authorizationId: result.authorizationId ?? null,
nsu: result.nsu ?? null,
tid: result.tid ?? null,
acquirer: "MyAcquirer",
code: result.code ?? null,
message: result.message ?? null,
delayToAutoSettle: 21600, // 6 hours in seconds
delayToAutoSettleAfterAntifraud: 1800, // 30 minutes in seconds
delayToCancel: 21600, // 6 hours in seconds
};
res.status(200).json(response);
}
Wrong
// Missing required fields — Gateway will reject this response
async function createPaymentHandler(req: Request, res: Response): Promise<void> {
const result = await processPaymentWithAcquirer(req.body);
// Missing: authorizationId, nsu, tid, acquirer, code, message,
// delayToAutoSettle, delayToAutoSettleAfterAntifraud, delayToCancel
res.status(200).json({
paymentId: req.body.paymentId,
status: result.status,
});
}
The GET /manifest endpoint MUST return a paymentMethods array listing every payment method the connector supports, with the correct name and allowsSplit configuration for each.
Why this matters
The Gateway reads the manifest to determine which payment methods are available. If a method is missing, merchants cannot configure it in the VTEX Admin. An incorrect allowsSplit value causes split payment failures.
Detection
If the manifest handler returns an empty paymentMethods array or hardcodes methods the provider does not actually support, STOP and fix the manifest.
Correct
async function manifestHandler(_req: Request, res: Response): Promise<void> {
const manifest = {
paymentMethods: [
{ name: "Visa", allowsSplit: "onCapture" },
{ name: "Mastercard", allowsSplit: "onCapture" },
{ name: "American Express", allowsSplit: "onCapture" },
{ name: "BankInvoice", allowsSplit: "onAuthorize" },
{ name: "Pix", allowsSplit: "disabled" },
],
};
res.status(200).json(manifest);
}
Wrong
// Empty manifest — no payment methods will appear in the Admin
async function manifestHandler(_req: Request, res: Response): Promise<void> {
res.status(200).json({ paymentMethods: [] });
}
Architecture overview:
Shopper → VTEX Checkout → VTEX Payment Gateway → [Your Connector Middleware] → Acquirer/PSP
↕
Configuration Flow (Admin)
Recommended TypeScript interfaces for all endpoint contracts:
// --- Manifest ---
interface ManifestResponse {
paymentMethods: Array<{
name: string;
allowsSplit: "onCapture" | "onAuthorize" | "disabled";
}>;
}
// --- Create Payment ---
interface CreatePaymentRequest {
reference: string;
orderId: string;
transactionId: string;
paymentId: string;
paymentMethod: string;
value: number;
currency: string;
installments: number;
card?: {
holder: string;
number: string;
csc: string;
expiration: { month: string; year: string };
};
miniCart: Record<string, unknown>;
callbackUrl: string;
returnUrl?: string;
}
interface CreatePaymentResponse {
paymentId: string;
status: "approved" | "denied" | "undefined";
authorizationId: string | null;
nsu: string | null;
tid: string | null;
acquirer: string | null;
code: string | null;
message: string | null;
delayToAutoSettle: number;
delayToAutoSettleAfterAntifraud: number;
delayToCancel: number;
paymentUrl?: string;
}
// --- Cancel Payment ---
interface CancelPaymentResponse {
paymentId: string;
cancellationId: string | null;
code: string | null;
message: string | null;
requestId: string;
}
// --- Capture/Settle Payment ---
interface CapturePaymentResponse {
paymentId: string;
settleId: string | null;
value: number;
code: string | null;
message: string | null;
requestId: string;
}
// --- Refund Payment ---
interface RefundPaymentResponse {
paymentId: string;
refundId: string | null;
value: number;
code: string | null;
message: string | null;
requestId: string;
}
// --- Inbound Request ---
interface InboundResponse {
requestId: string;
paymentId: string;
responseData: {
statusCode: number;
contentType: string;
content: string;
};
}
Complete payment flow router with all 6 endpoints:
import { Router, Request, Response } from "express";
const router = Router();
router.get("/manifest", async (_req: Request, res: Response) => {
res.status(200).json({
paymentMethods: [
{ name: "Visa", allowsSplit: "onCapture" },
{ name: "Mastercard", allowsSplit: "onCapture" },
{ name: "Pix", allowsSplit: "disabled" },
],
});
});
router.post("/payments", async (req: Request, res: Response) => {
const body: CreatePaymentRequest = req.body;
const result = await processWithAcquirer(body);
const response: CreatePaymentResponse = {
paymentId: body.paymentId,
status: result.status,
authorizationId: result.authorizationId ?? null,
nsu: result.nsu ?? null,
tid: result.tid ?? null,
acquirer: "MyProvider",
code: result.code ?? null,
message: result.message ?? null,
delayToAutoSettle: 21600,
delayToAutoSettleAfterAntifraud: 1800,
delayToCancel: 21600,
};
res.status(200).json(response);
});
router.post("/payments/:paymentId/cancellations", async (req: Request, res: Response) => {
const { paymentId } = req.params;
const { requestId } = req.body;
const result = await cancelWithAcquirer(paymentId);
res.status(200).json({
paymentId,
cancellationId: result.cancellationId ?? null,
code: result.code ?? null,
message: result.message ?? "Successfully cancelled",
requestId,
});
});
router.post("/payments/:paymentId/settlements", async (req: Request, res: Response) => {
const body = req.body;
const result = await captureWithAcquirer(body.paymentId, body.value);
res.status(200).json({
paymentId: body.paymentId,
settleId: result.settleId ?? null,
value: result.capturedValue ?? body.value,
code: result.code ?? null,
message: result.message ?? null,
requestId: body.requestId,
});
});
router.post("/payments/:paymentId/refunds", async (req: Request, res: Response) => {
const body = req.body;
const result = await refundWithAcquirer(body.paymentId, body.value);
res.status(200).json({
paymentId: body.paymentId,
refundId: result.refundId ?? null,
value: result.refundedValue ?? body.value,
code: result.code ?? null,
message: result.message ?? null,
requestId: body.requestId,
});
});
router.post("/payments/:paymentId/inbound-request/:action", async (req: Request, res: Response) => {
const body = req.body;
const result = await handleInbound(body);
res.status(200).json({
requestId: body.requestId,
paymentId: body.paymentId,
responseData: {
statusCode: 200,
contentType: "application/json",
content: JSON.stringify(result),
},
});
});
export default router;
Configuration flow endpoints (optional, for merchant onboarding):
import { Router, Request, Response } from "express";
const configRouter = Router();
// 1. POST /authorization/token
configRouter.post("/authorization/token", async (req: Request, res: Response) => {
const { applicationId, returnUrl } = req.body;
const token = await generateAuthorizationToken(applicationId, returnUrl);
res.status(200).json({ applicationId, token });
});
// 2. GET /authorization/redirect
configRouter.get("/authorization/redirect", async (req: Request, res: Response) => {
const { token } = req.query;
const providerLoginUrl = buildProviderLoginUrl(token as string);
res.redirect(302, providerLoginUrl);
});
// 3. GET /authorization/credentials
configRouter.get("/authorization/credentials", async (req: Request, res: Response) => {
const { authorizationCode } = req.query;
const credentials = await exchangeCodeForCredentials(authorizationCode as string);
res.status(200).json({
applicationId: "vtex",
appKey: credentials.appKey,
appToken: credentials.appToken,
});
});
export default configRouter;
delayToAutoSettle, delayToAutoSettleAfterAntifraud, or delayToCancel from the Create Payment response, or setting them to zero. This causes immediate auto-capture or auto-cancel, leading to premature settlement or lost payments.paymentId and status without authorizationId, tid, nsu, acquirer, etc. The Gateway deserializes all fields and treats missing ones as failures.delayToAutoSettle, delayToAutoSettleAfterAntifraud, and delayToCancel set to sensible non-zero values?payment-idempotency — Idempotency keys (paymentId, requestId) and state machine for duplicate preventionpayment-async-flow — Async payment methods, callbackUrl, and the 7-day retry windowpayment-pci-security — PCI compliance, Secure Proxy, and card data handlingpayment-ppp-pos — POS / Sales App card-present overlay; use with this skill for endpoint shapesvtex-io-application-performance — Per-client timeout/retry tuning, VBase correctness constraints, and structured logging for IO-based payment connectorsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub vtex/skills --plugin vtex-ai-skills46 skills in this plugin
/architecture-well-architected-commerceApply when scoping, reviewing, or documenting cross-cutting VTEX commerce architecture across storefront, IO, headless, marketplace, payments, or any other VTEX module. Grounds work in the Well-Architected Commerce framework—Technical Foundation (reliability, trust, integrity; security, infrastructure, compliance), Future-proof (innovation, simplicity, efficiency; scalable and adaptable solutions), and Operational Excellence (accuracy, accountability, data-driven improvement; process and customer experience). Routes implementation detail to product tracks (IO caching and paths, Master Data strategy, marketplace integrations). Use for solution design, architecture reviews, and RFP-level technical structure./faststore-storefrontCore coding rules and workflow for developing VTEX FastStore storefronts. Use when starting any FastStore development task, writing TypeScript/React components, creating section overrides, extending the BFF, or styling. Covers all primary conventions, safety rules, and the development workflow used across every FastStore project./headless-bff-architectureApply when designing or modifying a BFF (Backend-for-Frontend) layer, middleware, or API proxy for a headless VTEX storefront. Covers BFF middleware architecture, public vs private API classification, VtexIdclientAutCookie management, API key protection, and secure request proxying. Use for any headless commerce project that must never expose VTEX_APP_KEY or call private VTEX APIs from the browser./headless-caching-strategyApply when implementing caching logic, CDN configuration, or performance optimization for a headless VTEX storefront. Covers which VTEX APIs can be cached (Intelligent Search, Catalog) versus which must never be cached (Checkout, Profile, OMS), stale-while-revalidate patterns, cache invalidation, and BFF-level caching. Use for any headless project that needs TTL rules and caching strategy guidance./headless-checkout-proxyApply when implementing cart, checkout, or order placement logic proxied through a BFF for headless VTEX storefronts. Covers OrderForm lifecycle, cart creation, item management, profile/shipping/payment attachments, orderFormId management, and secure checkout flows. Use for any headless frontend that needs to proxy VTEX Checkout API calls through a server-side layer with proper session cookie handling./headless-intelligent-searchApply when implementing search functionality, faceted navigation, or autocomplete in a headless VTEX storefront. Covers product_search, autocomplete_suggestions, facets, banners, correction_search, and top_searches endpoints, plus analytics event collection. Use for any custom frontend that integrates VTEX Intelligent Search API for product discovery and search result rendering.Other plugins' skills for the same job