Developer-First Payment Infrastructure
MAGNETPAY's payment API is built by developers, for developers. RESTful design, comprehensive webhooks, idempotent operations, and SDKs in 6 languages make integrating payments as straightforward as any modern API.
Built for Developer Productivity
Every aspect of the MAGNETPAY payment API is designed to reduce integration time and prevent production issues.
RESTful API Design
Predictable, resource-oriented URLs with standard HTTP methods. JSON request/response bodies, consistent error formats, and pagination across all endpoints.
Webhook Events
Real-time event notifications for 50+ event types. HMAC-SHA256 signed payloads, automatic retries with exponential backoff, and a searchable event log for debugging.
Idempotency Keys
Every mutating endpoint supports idempotency keys to safely retry requests without duplicate side effects. Critical for payment operations where network failures happen.
Sandbox & Live Modes
Separate sandbox and live environments with isolated API keys. Test your full integration with simulated payment flows before going to production. No real money moves in sandbox.
SDKs & Libraries
Official SDKs for Node.js, Python, Go, Ruby, PHP, and Java. Type-safe clients with auto-generated models, built-in retries, and idempotency key management.
Rate Limiting & Quotas
Transparent rate limits with headers on every response. Burst-friendly limits for payment operations. Automatic backpressure with Retry-After headers for graceful degradation.
Official Payment API SDKs
npm install @magnetpay/nodepip install magnetpaygo get github.com/magnetpay/gogem install magnetpaycomposer require magnetpay/phpcom.magnetpay:magnetpay-javaFrom Zero to Payments in 4 Steps
Go from sign-up to processing payments in under an hour. Our payment API is designed for rapid integration.
Get API Keys
Sign up and receive sandbox API keys instantly. Your sandbox environment mirrors production with simulated payment flows for cards, crypto, and payouts.
Install an SDK
Choose your language and install the official SDK. Every SDK provides typed models, automatic retries, webhook verification helpers, and idempotency key management.
Build & Test in Sandbox
Develop your integration against the sandbox API. Use test card numbers, simulated crypto deposits, and webhook testing tools to validate every flow.
Go Live
Switch to live API keys when ready. The same code works in both environments. Our onboarding team reviews your integration for best practices before launch.
Payment API Quick Start
Create a payment, handle the webhook, and verify the signature in a few lines of code.
import MagnetPay from '@magnetpay/node';
const magnetpay = new MagnetPay('sk_live_...');
// Create a payment intent with idempotency
const payment = await magnetpay.paymentIntents.create({
amount: 4999,
currency: 'usd',
payment_method_types: ['card'],
customer: 'cus_9f3kR2xL',
}, {
idempotencyKey: 'order_abc123',
});
// Verify a webhook signature
app.post('/webhooks/magnetpay', (req, res) => {
const event = magnetpay.webhooks.verify(
req.body,
req.headers['magnetpay-signature'],
'whsec_...',
);
switch (event.type) {
case 'payment_intent.succeeded':
await fulfillOrder(event.data.metadata.order_id);
break;
case 'payment_intent.failed':
await notifyCustomer(event.data.customer);
break;
}
res.json({ received: true });
});{
"id": "evt_3kXj9v2eZ",
"object": "event",
"type": "payment_intent.succeeded",
"created": "2026-03-25T12:00:30Z",
"data": {
"id": "pi_3kXj9v2eZ",
"object": "payment_intent",
"status": "succeeded",
"amount": 4999,
"currency": "usd",
"payment_method": "pm_card_visa_4242",
"metadata": {
"order_id": "ord_28571"
}
},
"api_version": "2026-03-01"
}Payment API Design Principles
Consistent Error Handling
Every error response includes a machine-readable type, human-readable message, error code, and parameter field. 4xx errors include suggested fixes. 5xx errors include a request ID for support.
Versioned API
API versions are date-based (e.g., 2026-03-01). Pin your version in the header and upgrade on your schedule. Breaking changes only happen in new versions. Deprecation notices 12 months in advance.
Cursor-Based Pagination
All list endpoints use cursor-based pagination for consistent results even as data changes. Each response includes has_more and a cursor for the next page. No offset-based skipping issues.
Expandable Objects
Reduce API calls with the expand parameter. Request nested objects inline instead of making separate calls. For example, expand customer and payment_method in a single payment intent fetch.
Payment API FAQ
What makes MAGNETPAY a developer-first payment API?
MAGNETPAY is designed for developers from the ground up. Our payment API follows REST conventions with predictable URLs, standard HTTP methods, and consistent JSON responses. Every endpoint supports idempotency keys for safe retries. We provide SDKs in 6 languages, a full sandbox environment, interactive API documentation, and webhook testing tools. Error messages include machine-readable codes and human-readable descriptions with suggested fixes.
How do webhooks work in MAGNETPAY?
MAGNETPAY sends webhook events to your configured endpoints for 50+ event types including payment.succeeded, payout.completed, subscription.renewed, and card.authorization. Each webhook payload is signed with HMAC-SHA256 using your webhook secret, allowing you to verify authenticity. Failed deliveries are retried with exponential backoff (1 min, 5 min, 30 min, 2 hours, 24 hours). You can view delivery attempts and replay events from the dashboard.
What is idempotency and why does it matter for payments?
Idempotency ensures that repeating the same API request produces the same result without creating duplicate transactions. This is critical for payment APIs where network timeouts or failures can leave the client uncertain about whether a payment was processed. MAGNETPAY supports idempotency keys on all mutating endpoints. Pass the same Idempotency-Key header, and we return the original response without re-executing the operation.
How does the sandbox environment work?
The sandbox is a fully-functional replica of the production environment. It supports simulated card payments (with test card numbers), fake crypto deposits (triggered via API), and mock payout deliveries. Webhook events fire in sandbox just like production. Sandbox and live environments use separate API keys and separate data, so testing never affects real customers or transactions. There is no rate limit on sandbox for development convenience.
What rate limits apply to the payment API?
MAGNETPAY applies rate limits per API key: 1,000 requests/minute for payment operations (creates, captures, refunds), 5,000 requests/minute for read operations (gets, lists), and 100 requests/minute for bulk operations (batch payouts, batch updates). Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. When limits are exceeded, we return 429 with a Retry-After header. Contact us for higher limits if needed.
Explore Payment Features
Start Building with MAGNETPAY
Get your API keys in 30 seconds. Full sandbox access, interactive documentation, and SDKs in 6 languages. No credit card required to start.