Skip to main content
POST
cURL

Credit Card Payments

Process credit card payments directly through the Host-to-Host API with full control over the payment flow, including 3D Secure authentication and advanced fraud protection.

Overview

Credit card processing through H2H API provides:
  • Direct Processing: Server-to-server credit card processing
  • 3D Secure Support: Enhanced security with 3DS authentication
  • Multiple Card Types: Support for Visa, Mastercard, American Express, and more
  • Real-time Processing: Immediate payment processing and response
  • Fraud Protection: Advanced fraud detection and prevention

Required Parameters

Core Credit Card Fields

Customer Information

Transaction Details

Optional Parameters

Browser Info Object

For 3D Secure authentication, include browser information:

Complete Request Example

Implementation Example

JavaScript/Node.js

PHP

3D Secure Authentication

3DS Flow

  1. Initial Request: Submit payment with browser info
  2. 3DS Check: System determines if 3DS is required
  3. Challenge: Customer completes 3DS challenge if needed
  4. Final Processing: Payment processed after authentication

Browser Info Collection

Error Handling

Common Error Codes

  • INVALID_CARD: Invalid card number or format
  • EXPIRED_CARD: Card has expired
  • INSUFFICIENT_FUNDS: Insufficient funds on card
  • CARD_DECLINED: Card declined by issuer
  • CVV_MISMATCH: CVV verification failed
  • 3DS_FAILED: 3D Secure authentication failed

Error Response Example

Security Best Practices

PCI DSS Compliance

  • Never Store: Never store card numbers, CVV, or expiration dates
  • Secure Transmission: Use HTTPS for all API communications
  • Data Minimization: Only collect necessary card data
  • Access Control: Restrict access to payment processing systems

Implementation Security

  • API Key Protection: Store API keys securely
  • Input Validation: Validate all input parameters
  • Error Handling: Don’t expose sensitive information in errors
  • Logging: Log transactions without sensitive data

Testing

Test Card Numbers

Test Scenarios

  • Successful Payment: Use valid test card numbers
  • Declined Payment: Use specific test numbers for declines
  • 3DS Challenge: Test 3D Secure authentication flows
  • Network Errors: Test timeout and network failure scenarios

Best Practices

Implementation

  1. Validation: Validate card data before API calls
  2. Error Handling: Implement comprehensive error handling
  3. Retry Logic: Use appropriate retry mechanisms
  4. Monitoring: Monitor payment success rates

User Experience

  1. Real-time Validation: Validate card details as user types
  2. Clear Errors: Provide clear, actionable error messages
  3. Loading States: Show processing indicators
  4. Security Indicators: Display security badges and SSL indicators

Performance

  1. Connection Pooling: Use HTTP connection pooling
  2. Timeout Handling: Set appropriate timeout values
  3. Async Processing: Handle responses asynchronously
  4. Caching: Cache non-sensitive configuration data

Next Steps

3D Secure Integration

Learn about 3D Secure authentication implementation

Payment Status

Track credit card payment status

Webhooks

Handle payment status notifications

Path Parameters

id
integer<int64>
required

Query Parameters

transaction3dsId
string

Body

name
string
required
Maximum string length: 100
number
string
required
Required string length: 8 - 19
expiration
string
required
Minimum string length: 1
Pattern: ^\d{2}\/\d{2}$
cvv
string
required
Required string length: 3 - 4
Pattern: ^\d+$
email
string<email>
required
Maximum string length: 100
phoneNumber
string
required
Required string length: 10 - 14
Pattern: ^\d+$
address
string
required
Maximum string length: 100
city
string
required
Maximum string length: 50
state
string
required
Minimum string length: 1
postalCode
string
required
Maximum string length: 10
country
string
required
Required string length: 2
captureDelayHours
integer<int32>
Required range: 0 <= x <= 7
browserInfo
object
wallet
object
is3ds
boolean
isSandbox
boolean
ipAddress
string | null

Response

OK