@vtex/payment-provider package and represent incoming payment operations from VTEX’s Payment Gateway.
AuthorizationRequest
Represents a request to authorize a payment transaction. This is the primary request type that initiates the payment flow.Unique identifier for the payment transaction
VTEX transaction identifier
Payment method name (e.g., “Visa”, “Mastercard”, “BankInvoice”)
Name of the merchant account
Transaction amount in cents (e.g., 1050 for $10.50)
Three-letter ISO currency code (e.g., “USD”, “BRL”)
Number of installments for the payment
Device fingerprint for fraud detection
Card information for card-based payments
Shopping cart information
Custom configuration values from the provider’s
configuration.json customFieldsCustomer’s IP address
Type guards
The framework provides helper functions to identify authorization types:The
card field is only present when isCardAuthorization() returns true. Always use type guards to safely access card data.CancellationRequest
Represents a request to cancel a previously authorized payment.Unique identifier for the original payment transaction
Unique identifier for this cancellation request
Authorization identifier returned from the original authorization
VTEX transaction identifier
Amount to cancel in cents
Custom configuration values from the provider’s settings
Usage example
RefundRequest
Represents a request to refund a settled payment transaction.Unique identifier for the original payment transaction
Unique identifier for this refund request
Settlement identifier from the original settlement
VTEX transaction identifier
Amount to refund in cents
Custom configuration values from the provider’s settings
Refunds can only be performed on settled transactions. Use cancellations for authorized-but-not-settled payments.
SettlementRequest
Represents a request to settle (capture) an authorized payment.Unique identifier for the payment transaction
Unique identifier for this settlement request
Authorization identifier from the original authorization
VTEX transaction identifier
Amount to settle in cents (must not exceed authorized amount)
Custom configuration values from the provider’s settings
Usage example
Common patterns
Accessing merchant settings
All request types includemerchantSettings which contains the custom fields defined in configuration.json:
Handling different payment methods
- Credit card
- Bank invoice