API Reference
The AccruPay API is a GraphQL-based RESTful API that provides access to all payment processing features.
Overview
The API is built with GraphQL, providing:
- Type Safety - Strongly typed queries and mutations
- Flexibility - Request exactly the data you need
- Self-Documenting - Schema introspection and built-in documentation
- Single Endpoint - All operations through one endpoint
Base URL
Production
https://api.pay.accru.co/graphql
QA
https://api.qa.pay.accru.co/graphql
Authentication
All API requests require an API secret in the request headers:
accrupay-api-secret: your-api-secret
GraphQL Playground
Access the GraphQL Playground to explore the schema and test queries:
- Production: https://api.pay.accru.co/graphql
- QA: https://api.qa.pay.accru.co/graphql
Making Requests
cURL Example
curl -X POST https://api.pay.accru.co/graphql \
-H "Content-Type: application/json" \
-H "accrupay-api-secret: your-api-secret" \
-d '{
"query": "{ merchantApi { id name } }"
}'
JavaScript Example
const response = await fetch('https://api.pay.accru.co/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'accrupay-api-secret': 'your-api-secret',
},
body: JSON.stringify({
query: `
query {
merchantApi {
id
name
}
}
`,
}),
});
const { data } = await response.json();
Key Concepts
Queries vs Mutations
- Queries - Read data (transactions, payment methods, etc.)
- Mutations - Modify data (start sessions, refund transactions, etc.)
Pagination
Most list queries support pagination with skip and take parameters:
query {
merchantApiTransactions(take: 10, skip: 0) {
items {
id
amount
}
totalCount
}
}
Sorting
List queries support sorting:
query {
merchantApiTransactions(
sorting: [{ field: createdAt, order: DESC }]
) {
items {
id
createdAt
}
}
}
Core Modules
- Transactions - Payment processing and management
- Payment Methods - Stored payment information
- Payment Plans - Recurring payment configurations
Using the SDK
We recommend using the Node.js SDK instead of making raw GraphQL requests. The SDK provides:
- Type safety
- Simplified API
- Built-in error handling
- Better developer experience
Next Steps
- GraphQL Schema - Explore the full GraphQL schema
- Transactions API - Learn about transaction operations
- SDK Reference - Use our Node.js SDK