Skip to main content

Prerequisites

  • PHP 7.4 or higher
  • cURL extension enabled
  • Card2Crypto account with API key

Quick Start

1. Set Up Environment Variables

Create a .env file in your project root:
Add to .gitignore:

2. Load Environment Variables

3. Create Card2Crypto Class

Creating Payments

Basic Payment Creation

Payment with Database

Handling Return URL

Webhook Integration

Basic Webhook Handler

Complete Example with Database

Error Handling

Testing

Local Testing

Best Practices

  1. Never expose API keys in frontend code
  2. Always verify webhook signatures
  3. Use prepared statements to prevent SQL injection
  4. Validate and sanitize all user input
  5. Log all payment-related events
  6. Handle errors gracefully
  7. Use HTTPS in production
  8. Keep dependencies updated
  9. Test with real payments before going live
  10. Implement proper error logging

Security Checklist

  • Store API keys in environment variables
  • Use HTTPS for all payment pages
  • Verify webhook signatures
  • Sanitize all user input
  • Use prepared statements for database queries
  • Enable PHP error logging
  • Set appropriate file permissions
  • Keep PHP version updated
  • Use secure session handling

Next Steps

API Reference

Complete API documentation

Webhook Security

Learn about webhook verification

Node.js Guide

Integration guide for Node.js

Testing Guide

How to test your integration