API Documentation
Complete reference for the Paynix API
Authentication
Learn how to authenticate your API requests
Required
The Paynix API uses API keys to authenticate requests. You can view and manage your API keys in the Paynix Dashboard.
Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
Authorization: Bearer sk_test_51Hg...
POST
/payments
Create a new payment
Request Parameters
{ "amount": 1000, // Amount in cents "currency": "usd", // 3-letter ISO currency code "payment_method": "pm_card_visa", // Payment method ID "description": "Payment for order #1234", "customer": "cus_123456", // Optional customer ID "metadata": { // Optional metadata "order_id": "1234" } }
Response
{ "id": "py_123456789", "object": "payment", "amount": 1000, "currency": "usd", "status": "succeeded", "description": "Payment for order #1234", "customer": "cus_123456", "payment_method": "pm_card_visa", "created": 1619107884, "metadata": { "order_id": "1234" } }
GET
/payments/{payment_id}
Retrieve a payment
Path Parameters
payment_id: string // The ID of the payment to retrieve
Response
{ "id": "py_123456789", "object": "payment", "amount": 1000, "currency": "usd", "status": "succeeded", "description": "Payment for order #1234", "customer": "cus_123456", "payment_method": "pm_card_visa", "created": 1619107884, "metadata": { "order_id": "1234" } }
Code Examples
Examples of how to use the Paynix API in different languages
// Create a payment const payflow = require('payflow-node'); payflow.apiKey = 'sk_test_51Hg...'; const payment = await payflow.payments.create({ amount: 2000, currency: 'usd', payment_method: 'pm_card_visa', description: 'My first payment', confirm: true, }); console.log(payment.id);