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
Parameter | Description | Required | Example |
---|---|---|---|
name | Card holder full name | YES | ”John Doe” |
number | Credit card number | YES | ”4111111111111111” |
expiration | Card expiration (MM/YY) | YES | ”12/25” |
cvv | Card verification value | YES | ”123” |
Customer Information
Parameter | Description | Required | Example |
---|---|---|---|
email | Customer email address | YES | ”john@example.com” |
phoneNumber | Customer phone number | YES | ”+1234567890” |
address | Billing address | YES | ”123 Main St” |
city | Billing city | YES | ”New York” |
state | State or province | YES | ”NY” |
postalCode | ZIP or postal code | YES | ”10001” |
country | Country code (ISO 3166-1) | YES | ”US” |
Transaction Details
Parameter | Description | Required | Example |
---|---|---|---|
amount | Payment amount | YES | 99.99 |
unit | Currency code | YES | ”USD” |
originDomain | Merchant domain | YES | ”shop.example.com” |
referenceId | Merchant reference | NO | ”ORDER-12345” |
Optional Parameters
Parameter | Description | Required | Example |
---|---|---|---|
captureDelayHours | Capture delay (0-7 hours) | NO | 0 |
notifyUrl | Webhook notification URL | NO | ”https://api.example.com/webhook” |
successUrl | Success redirect URL | NO | ”https://shop.example.com/success” |
failureUrl | Failure redirect URL | NO | ”https://shop.example.com/failure” |
browserInfo | 3DS browser information | NO | See browser info object |
Browser Info Object
For 3D Secure authentication, include browser information:Complete Request Example
Implementation Example
JavaScript/Node.js
PHP
3D Secure Authentication
3DS Flow
- Initial Request: Submit payment with browser info
- 3DS Check: System determines if 3DS is required
- Challenge: Customer completes 3DS challenge if needed
- 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
Card Type | Number | CVV | Expiry |
---|---|---|---|
Visa | 4111111111111111 | 123 | 12/25 |
Mastercard | 5555555555554444 | 123 | 12/25 |
American Express | 378282246310005 | 1234 | 12/25 |
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
- Validation: Validate card data before API calls
- Error Handling: Implement comprehensive error handling
- Retry Logic: Use appropriate retry mechanisms
- Monitoring: Monitor payment success rates
User Experience
- Real-time Validation: Validate card details as user types
- Clear Errors: Provide clear, actionable error messages
- Loading States: Show processing indicators
- Security Indicators: Display security badges and SSL indicators
Performance
- Connection Pooling: Use HTTP connection pooling
- Timeout Handling: Set appropriate timeout values
- Async Processing: Handle responses asynchronously
- 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
Query Parameters
Body
Maximum length:
100
Required string length:
8 - 19
Minimum length:
1
Required string length:
3 - 4
Maximum length:
100
Required string length:
10 - 14
Maximum length:
100
Maximum length:
50
Minimum length:
1
Maximum length:
10
Required string length:
2
Required range:
0 <= x <= 7
Response
OK