Introduction
The Server-to-Server (S2S) Card Payment integration provides a secure way to process card transactions directly from your backend while maintaining PCI compliance. Support both new card payments and saved card tokens through dedicated APIs for optimal user experience and security.3D Secure Ready
Built-in 3D Secure authentication for enhanced security and compliance
Card Tokenization
Save cards using dedicated API for faster repeat payments without storing sensitive data
Real-time Callbacks
Receive instant payment status updates via server-to-server webhooks
3D Secure Authentication
3D Secure (3DS) is an authentication protocol that adds an extra layer of security for online card transactions. When a payment requires 3DS verification, EximPe returns an ACS (Access Control Server) template that must be rendered in the customer’s browser to complete authentication.Prerequisites
Before you begin, ensure you have:- API Credentials: Your EximPe client ID, client secret, and merchant ID for authentication.
- Callback URL: A publicly accessible URL configured in your EximPe dashboard for server-to-server callbacks.
- HTTPS Endpoint: All card payment endpoints must use HTTPS for security compliance.
- 3DS Integration: Frontend capability to render HTML forms for 3D Secure authentication.
- Initiate payment (new card or saved token)
- Handle 3D Secure authentication (if required)
- Check payment transaction status
- EximPe sends Server-to-Server callback response
Step 1: Initiate Payment
New Card Payment
For first-time card payments, provide complete card details:Saved Card Token Payment
For repeat payments using previously saved cards:For S2S Card Payment requests, you must include these required parameters:
collection_mode
: must be set to"s2s"
mop_type
: either"CREDIT_CARD"
or"DEBIT_CARD"
buyer.ip_address
: the customer’s device IP address (required for fraud prevention)buyer.user_agent
: the customer’s browser user-agent string (required for fraud prevention)card_details
: either complete card information or saved token details
S2S Card Payment Response
order_id
: Unique order identifier for tracking the transactionacs_template
: Base64-encoded HTML form for 3D Secure authentication (when required)
Step 2: Handle 3D Secure Authentication
When 3D Secure authentication is required, EximPe returns anacs_template
that must be processed on the frontend:
3DS Authentication Flow
- Decode the ACS Template: The
acs_template
is Base64-encoded HTML - Render in Browser: Display the decoded HTML in the customer’s browser
- Auto-Submit Form: The form will automatically submit to the bank’s authentication server
- Customer Authentication: Customer completes authentication (OTP, PIN, biometric, etc.)
- Redirect to Return URL: After authentication, customer is redirected to your
return_url
Frontend Implementation Example
Security Note: Always decode and render the ACS template in a secure context (HTTPS) and validate the response from the authentication server before proceeding with order fulfillment.
Saved Card Tokens
EximPe’s card tokenization system uses a dedicated API approach to securely save card details for future payments:Tokenization Workflow
- Process Payment: Use the Create Order API with new card details
- Save Card (optional): After successful payment, call the Save Card API to tokenize
- Future Payments: Use saved tokens instead of card details for repeat transactions
Saving Cards After Payment
Use the dedicated Save Card API to tokenize cards after successful payment:Complete Tokenization Example
Using Saved Tokens
For repeat payments, use the saved token instead of card details:Token Management APIs
- Save Card: Tokenize card details without processing payment
- List Saved Cards: Retrieve customer’s saved cards
- Delete Saved Card: Remove saved card tokens
Step 3: Check Payment Transaction Status
Use the Order Details API to retrieve the current payment status:For detailed parameters and response formats, see the Get Order API
Payment Status Values
Status | Description |
---|---|
PENDING | Payment initiated, awaiting completion |
SUCCESS | Payment completed successfully |
FAILED | Payment failed or was declined |
CANCELLED | Payment was cancelled by customer |
EXPIRED | Payment session expired |
Step 4: Server-to-Server Callback Response
EximPe sends real-time webhook notifications when payment status changes:Security Best Practices
PCI DSS Compliance
- Never log card details: Ensure card numbers, CVV, and other sensitive data are never logged
- Use HTTPS: All card payment endpoints must use HTTPS encryption
- Tokenize when needed: Use the Save Card API to convert card details to tokens for repeat customers
- Validate inputs: Implement proper validation for all card-related fields
Fraud Prevention
- Required fields: Always include
ip_address
anduser_agent
for fraud detection - Velocity checks: Monitor for unusual payment patterns
- Address verification: Validate billing address information
- CVV verification: Always require CVV for new card transactions
3D Secure Best Practices
- Fallback handling: Implement proper error handling for failed 3DS authentication
- Timeout management: Set appropriate timeouts for 3DS flows
- Mobile optimization: Ensure 3DS works seamlessly on mobile devices
- User experience: Provide clear instructions during authentication
Error Handling
Common Error Scenarios
Error Code | Description | Resolution |
---|---|---|
CARD_DECLINED | Bank declined the transaction | Ask customer to try different card or contact bank |
INSUFFICIENT_FUNDS | Not enough balance | Customer needs to check account balance |
EXPIRED_CARD | Card has expired | Customer needs to use valid card |
INVALID_CVV | Incorrect CVV provided | Ask customer to re-enter CVV |
3DS_FAILED | 3D Secure authentication failed | Customer needs to complete authentication |
NETWORK_ERROR | Network connectivity issues | Retry the transaction |
Implementation Tips
- Retry Logic: Implement exponential backoff for network-related errors
- User Feedback: Provide clear, actionable error messages to customers
- Logging: Log errors (without sensitive data) for debugging
- Monitoring: Set up alerts for high error rates or specific error types
Next Steps
- Test Integration: Use test cards and credentials to validate your integration
- Go Live: Switch to production credentials after thorough testing
- Monitor Performance: Track success rates, error patterns, and user experience metrics
- Optimize Flow: Continuously improve based on user feedback and analytics