Quickstart
Get started with the Paychtec API and process your first payment.
Prerequisites
Before you begin, make sure you have:
- A Paychtec account (sign up at the dashboard)
- Your API keys from the dashboard
Step 1: Get Your API Keys
Navigate to your Paychtec dashboard and find your API keys. You'll need:
| Key Type | Prefix | Use |
|---|---|---|
| Sandbox Secret Key | snd_ | For development and testing |
| Production Secret Key | prd_ | For production (real transactions) |
| Sandbox Publishable Key | pk_snd_ | For client-side token creation (testing) |
| Production Publishable Key | pk_prd_ | For client-side token creation (production) |
Keep Keys Secure. Never expose your secret keys in client-side code or version control. Use environment variables to store them securely.
Step 2: Make Your First API Call
Test your connection by making a simple request to the API:
curl 'https://api.v2.paychtec.com/health' \ -H "api-key: snd_YOUR_API_KEY"You should receive a 200 OK response confirming your API key is valid.
Step 3: Create Your First Payment
Now let's process a test payment. Use the test card number 4242424242424242 which always succeeds:
curl -X POST 'https://api.v2.paychtec.com/payments' \ -H "Content-Type: application/json" \ -H "api-key: snd_YOUR_API_KEY" \ -d '{"amount": 1000,"currency": "USD","profile_id": "YOUR_PROFILE_ID","customer_id": "YOUR_CUSTOMER_ID","description": "Order payment","capture_method": "automatic","email": "guest@example.com","authentication_type": "three_ds","confirm": true,"payment_method": "card","payment_method_data": { "card": { "card_number": "4242424242424242", "card_exp_month": "12", "card_exp_year": "2028", "card_cvc": "123" }},"billing": { "address": { "line1": "1600", "line2": "Amphitheatre Parkway", "city": "Mountain View", "state": "California", "zip": "94043", "country": "US", "first_name": "John", "last_name": "Doe" }, "phone": { "number": "6502530000", "country_code": "+1" }}}'const response = await fetch('https://api.v2.paychtec.com/payments', {method: 'POST',headers: { 'Content-Type': 'application/json', 'api-key': 'snd_YOUR_API_KEY',},body: JSON.stringify({ amount: 1000, currency: 'USD', profile_id: 'YOUR_PROFILE_ID', customer_id: 'YOUR_CUSTOMER_ID', description: 'Order payment', capture_method: 'automatic', email: 'guest@example.com', authentication_type: 'three_ds', confirm: true, payment_method: 'card', payment_method_data: { card: { card_number: '4242424242424242', card_exp_month: '12', card_exp_year: '2028', card_cvc: '123', }, }, billing: { address: { line1: '1600', line2: 'Amphitheatre Parkway', city: 'Mountain View', state: 'California', zip: '94043', country: 'US', first_name: 'John', last_name: 'Doe', }, phone: { number: '6502530000', country_code: '+1', }, },}),});const payment = await response.json();console.log(payment);import requestsresponse = requests.post( 'https://api.v2.paychtec.com/payments', headers={ 'Content-Type': 'application/json', 'api-key': 'snd_YOUR_API_KEY', }, json={ 'amount': 1000, 'currency': 'USD', 'profile_id': 'YOUR_PROFILE_ID', 'customer_id': 'YOUR_CUSTOMER_ID', 'description': 'Order payment', 'capture_method': 'automatic', 'email': 'guest@example.com', 'authentication_type': 'three_ds', 'confirm': True, 'payment_method': 'card', 'payment_method_data': { 'card': { 'card_number': '4242424242424242', 'card_exp_month': '12', 'card_exp_year': '2028', 'card_cvc': '123', }, }, 'billing': { 'address': { 'line1': '1600', 'line2': 'Amphitheatre Parkway', 'city': 'Mountain View', 'state': 'California', 'zip': '94043', 'country': 'US', 'first_name': 'John', 'last_name': 'Doe', }, 'phone': { 'number': '6502530000', 'country_code': '+1', }, }, },)payment = response.json()print(payment)<?php$curl = curl_init();curl_setopt_array($curl, [ CURLOPT_URL => 'https://api.v2.paychtec.com/payments', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'api-key: snd_YOUR_API_KEY', ], CURLOPT_POSTFIELDS => json_encode([ 'amount' => 1000, 'currency' => 'USD', 'profile_id' => 'YOUR_PROFILE_ID', 'customer_id' => 'YOUR_CUSTOMER_ID', 'description' => 'Order payment', 'capture_method' => 'automatic', 'email' => 'guest@example.com', 'authentication_type' => 'three_ds', 'confirm' => true, 'payment_method' => 'card', 'payment_method_data' => [ 'card' => [ 'card_number' => '4242424242424242', 'card_exp_month' => '12', 'card_exp_year' => '2028', 'card_cvc' => '123', ], ], 'billing' => [ 'address' => [ 'line1' => '1600', 'line2' => 'Amphitheatre Parkway', 'city' => 'Mountain View', 'state' => 'California', 'zip' => '94043', 'country' => 'US', 'first_name' => 'John', 'last_name' => 'Doe', ], 'phone' => [ 'number' => '6502530000', 'country_code' => '+1', ], ], ]),]);$response = curl_exec($curl);$payment = json_decode($response, true);print_r($payment);package mainimport ( "bytes" "encoding/json" "fmt" "net/http")func main() { payload := map[string]interface{}{ "amount": 1000, "currency": "USD", "profile_id": "YOUR_PROFILE_ID", "customer_id": "YOUR_CUSTOMER_ID", "description": "Order payment", "capture_method": "automatic", "email": "guest@example.com", "authentication_type": "three_ds", "confirm": true, "payment_method": "card", "payment_method_data": map[string]interface{}{ "card": map[string]string{ "card_number": "4242424242424242", "card_exp_month": "12", "card_exp_year": "2028", "card_cvc": "123", }, }, "billing": map[string]interface{}{ "address": map[string]string{ "line1": "1600", "line2": "Amphitheatre Parkway", "city": "Mountain View", "state": "California", "zip": "94043", "country": "US", "first_name": "John", "last_name": "Doe", }, "phone": map[string]string{ "number": "6502530000", "country_code": "+1", }, }, } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", "https://api.v2.paychtec.com/payments", bytes.NewBuffer(body)) req.Header.Set("Content-Type", "application/json") req.Header.Set("api-key", "snd_YOUR_API_KEY") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() var payment map[string]interface{} json.NewDecoder(resp.Body).Decode(&payment) fmt.Println(payment)}Step 4: Handle the Response
A successful payment returns the payment object with its current status:
{
"payment_id": "pay_1234567890abcdef",
"merchant_id": "mer_xyz789",
"status": "succeeded",
"amount": 1000,
"amount_received": 1000,
"currency": "USD",
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "4242",
"brand": "visa",
"exp_month": "12",
"exp_year": "2028"
}
},
"created": "2024-01-15T10:30:00Z"
}Check the status field to determine the payment outcome:
succeeded— Payment was successfulrequires_action— Additional authentication needed (3DS)failed— Payment failed (check error details)
Test Cards
Test card numbers for simulating different payment scenarios are available in your Merchant Dashboard. Navigate to Developers → Test Cards to view all available test cards including success, failure, and 3D Secure cards.
Next Steps
- Payments Guide — Learn about payment flows and capture methods
- Customer Management — Save customers and payment methods
- Web SDK — Integrate payments into your frontend
- Testing Guide — Comprehensive testing strategies