Payment Processing API
Overview
Base URL
https://api.paymentprocessing.com/v1Authentication
Endpoints
POST /payments
Content-Type: application/json
Authorization: Bearer <your_api_key>https://api.paymentprocessing.com/v1Content-Type: application/json
Authorization: Bearer <your_api_key>{
"amount": 100.00,
"currency": "USD",
"source": "tok_visa",
"description": "Payment for order #12345"
}{
"id": "pay_12345",
"amount": 100.00,
"currency": "USD",
"status": "succeeded",
"created_at": "2024-06-10T12:00:00Z"
}{
"error": "Invalid payment source"
}Authorization: Bearer <your_api_key>{
"id": "pay_12345",
"amount": 100.00,
"currency": "USD",
"status": "succeeded",
"created_at": "2024-06-10T12:00:00Z"
}{
"error": "Payment not found"
}Content-Type: application/json
Authorization: Bearer <your_api_key>{
"payment_id": "pay_12345",
"amount": 50.00
}{
"id": "refund_67890",
"payment_id": "pay_12345",
"amount": 50.00,
"status": "succeeded",
"created_at": "2024-06-10T13:00:00Z"
}{
"error": "Invalid refund amount"
}import requests
url = "https://api.paymentprocessing.com/v1/payments"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <your_api_key>"
}
data = {
"amount": 100.00,
"currency": "USD",
"source": "tok_visa",
"description": "Payment for order #12345"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())const fetch = require('node-fetch');
const url = 'https://api.paymentprocessing.com/v1/payments/pay_12345';
const options = {
method: 'GET',
headers: {
'Authorization': 'Bearer <your_api_key>'
}
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));