API Reference
Payments API
POST /v2/payments
Create a new payment
Parameters
amount
Amount and currency for the payment
object Required
payment_method
Payment method details
object Required
metadata
Additional metadata for the payment
object
// Request
curl -X POST https://api.finfusion.cloud/v2/payments \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": {
"value": 1000,
"currency": "USD"
},
"payment_method": {
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2024,
"cvc": "123"
}
},
"metadata": {
"order_id": "order_123",
"customer_id": "cust_456"
}
}'
// Response
{
"id": "pay_1234567890",
"status": "succeeded",
"amount": {
"value": 1000,
"currency": "USD"
},
"payment_method": {
"id": "pm_1234567890",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2024
}
},
"created_at": "2024-03-15T10:30:00Z",
"metadata": {
"order_id": "order_123",
"customer_id": "cust_456"
}
}
Responses
200 Payment created successfully
400 Invalid request parameters
402 Payment failed
GET /v2/payments/{payment_id}
Retrieve a payment
// Request
curl https://api.finfusion.cloud/v2/payments/pay_1234567890 \
-H "Authorization: Bearer YOUR_API_KEY"
// Response
{
"id": "pay_1234567890",
"status": "succeeded",
"amount": {
"value": 1000,
"currency": "USD"
},
"payment_method": {
"id": "pm_1234567890",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242"
}
}
}
Customers API
POST /v2/customers
Create a new customer
// Request
curl -X POST https://api.finfusion.cloud/v2/customers \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "customer@example.com",
"name": "John Doe",
"metadata": {
"company": "Acme Inc"
}
}'
// Response
{
"id": "cust_1234567890",
"email": "customer@example.com",
"name": "John Doe",
"created_at": "2024-03-15T10:30:00Z",
"metadata": {
"company": "Acme Inc"
}
}
Webhooks API
POST /v2/webhooks
Create a webhook endpoint
// Request
curl -X POST https://api.finfusion.cloud/v2/webhooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhooks",
"events": ["payment.succeeded", "payment.failed"],
"metadata": {
"environment": "production"
}
}'
// Response
{
"id": "whk_1234567890",
"url": "https://example.com/webhooks",
"events": ["payment.succeeded", "payment.failed"],
"status": "active",
"created_at": "2024-03-15T10:30:00Z"
}
Data Schemas
Payment
id
Unique identifier for the payment
string
amount
object
status
Current status of the payment
string
Enum: pending, succeeded, failed