Introduction
Welcome to the Ateni Pay API documentation. Ateni Pay provides a simple, secure way to accept payments online. Our API follows REST principles and returns JSON-encoded responses.
Base URL
https://api.atenipay.com/v1
Features
- Accept credit card payments
- Process refunds
- Manage customer profiles
- Recurring billing
- Secure tokenization
- Webhook notifications
Authentication
All API requests must be authenticated using your secret API key. Include it in the Authorization header of your requests.
Authorization: Bearer sk_test_1234567890abcdef
You can find your API keys in the Ateni Pay Dashboard. Use test keys for development and live keys for production.
API Keys
| Key Type | Prefix | Usage |
|---|---|---|
| Publishable Key | pk_test_... | Client-side operations |
| Secret Key | sk_test_... | Server-side operations |
Quick Start
Follow these steps to make your first payment with Ateni Pay:
1. Create a Payment Intent
First, create a Payment Intent on your server:
{
"amount": 2000,
"currency": "usd",
"payment_method_types": ["card"],
"metadata": {
"order_id": "12345"
}
}
2. Confirm the Payment
On the client side, use the client secret from the Payment Intent to confirm the payment:
// Using Ateni.js
ateni.confirmCardPayment(clientSecret, {
payment_method: {
card: cardElement,
billing_details: {
name: 'John Doe'
}
}
});
Payments
Process one-time and recurring payments with the Payments API.
Create a Payment
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | integer | Yes | Amount in smallest currency unit (e.g., cents) |
| currency | string | Yes | 3-letter ISO currency code |
| payment_method | string | Yes | ID of the payment method to use |
| customer | string | Optional | ID of the customer making the payment |
Example Response
{
"id": "pay_123456789",
"object": "payment",
"amount": 2000,
"currency": "usd",
"status": "succeeded",
"customer": "cus_123456789",
"created": 1616547890
}
Refunds
Process full or partial refunds for payments.
Create a Refund
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| payment | string | Yes | ID of the payment to refund |
| amount | integer | Optional | Amount to refund (defaults to full amount) |
| reason | string | Optional | Reason for the refund |
Webhooks
Webhooks allow you to receive real-time notifications about events that happen in your Ateni Pay account.
Setting Up Webhooks
Configure your webhook endpoint in the Ateni Pay Dashboard under Settings > Webhooks.
Verifying Webhooks
Each webhook request includes a signature that you should verify to ensure it came from Ateni Pay.
// Example webhook verification in Node.js
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSignature)
);
}