Prerequisites
Before you begin, ensure you have:- Node.js 12.x or higher installed
- VTEX IO CLI installed and configured
- Basic understanding of TypeScript
- Familiarity with payment processing concepts
Project structure
A payment connector app requires the following structure:Setting up the manifest
Create the manifest.json file
The
manifest.json file defines your app’s metadata and required permissions.manifest.json
The
paymentProvider builder is required for payment connector apps. The vbase-read-write policy allows you to persist data, and outbound-access enables callback functionality.Creating the connector class
Set up the service entry point
Create This file exports a
node/index.ts to initialize the payment provider service:node/index.ts
PaymentProviderService instance with your connector class.Extend the PaymentProvider class
Create
node/connector.ts and extend the PaymentProvider base class:node/connector.ts
The
PaymentProvider class provides access to:this.context- VTEX IO context with clients and configurationthis.isTestSuite- Boolean flag indicating if requests come from VTEX test suitethis.callback()- Method to send asynchronous responses
Implementing helper functions
Create utility functions to support your connector implementation:node/utils.ts
Using VBase for persistence
VBase allows you to persist data between requests. This is useful for handling asynchronous payment flows:Testing your connector
VTEX provides a test suite to validate your connector implementation:-
Link your app in a development workspace:
-
Run the payment provider test suite:
- The test suite will validate all required routes and flows
Common test failures and solutions
Common test failures and solutions
Authorization timeout
- Ensure your
authorizemethod returns a response within the timeout period - Use
Authorizations.pending()for async flows
- Call
this.callback()for pending transactions - Ensure the
outbound-accesspolicy is configured
- Use the helper methods from the
@vtex/payment-providerpackage - Validate your response matches the expected schema
Next steps
Implementing routes
Learn how to implement the required payment routes
Configuration
Configure your connector with manifest and service settings