Overview
ThePaymentProvider abstract class is the core building block for creating custom payment provider integrations with VTEX. Your connector must extend this class and implement its abstract methods to handle payment operations.
Class signature
Abstract methods
All methods must be implemented in your connector class.authorize()
Processes payment authorization requests. This is the primary method called when a customer attempts to pay.The authorization request containing payment details, including:
paymentId- Unique identifier for the paymentreference- Order reference numbervalue- Payment amount in centscurrency- Three-letter currency code (e.g., “USD”)cardorbankInvoice- Payment method detailscallbackUrl- URL for asynchronous callback notifications
Returns a promise that resolves to an authorization response with one of the following statuses:
approved- Payment approved immediatelydenied- Payment deniedpending- Payment requires asynchronous processing
node/connector.ts
Use
Authorizations.approve(), Authorizations.deny(), or Authorizations.pending() helper methods to construct the response.cancel()
Cancels a previously authorized payment that has not yet been settled.The cancellation request containing:
paymentId- The payment identifier to cancelrequestId- Unique identifier for this cancellation requestauthorizationId- The authorization ID returned during authorize
Returns a promise resolving to a cancellation response with status
approved or denied.node/connector.ts
Use
Cancellations.approve() or Cancellations.deny() to construct the response.settle()
Settles (captures) a previously authorized payment. This transfers funds from the customer to the merchant.The settlement request containing:
paymentId- The payment identifier to settlerequestId- Unique identifier for this settlement requestauthorizationId- The authorization ID to settlevalue- Amount to settle in cents (may be partial)
Returns a promise resolving to a settlement response with status
approved or denied.node/connector.ts
Use
Settlements.approve() or Settlements.deny() to construct the response.refund()
Refunds a settled payment, returning funds to the customer.The refund request containing:
paymentId- The payment identifier to refundrequestId- Unique identifier for this refund requestsettleId- The settlement ID to refundvalue- Amount to refund in cents (may be partial)
Returns a promise resolving to a refund response with status
approved or denied.node/connector.ts
Use
Refunds.approve() or Refunds.deny() to construct the response.inbound
Optional webhook handler for receiving notifications from your payment provider.Express-style request handler for processing inbound webhooks. Set to
undefined if not needed.Protected properties
context
Provides access to VTEX IO runtime context, including:
context.clients- Pre-configured clients (VBase, events, etc.)context.vtex- VTEX account and workspace information
isTestSuite
Indicates whether the request is from the VTEX test suite. Use this to enable test-specific behavior.
node/connector.ts
Protected methods
callback()
Sends asynchronous payment status updates to VTEX.The original authorization request
The updated authorization response to send
node/connector.ts
The
callback() method is used for asynchronous payment flows where the initial response is pending and the final status is determined later.Complete example
- Basic connector
- With async flow
node/connector.ts
See also
PaymentProviderService
Learn how to register your connector
Types & interfaces
Explore request and response types
Payment flows
Understand different payment flows
Creating a connector
Step-by-step implementation guide