Acumatica Payment Gateway Integration
February 20, 2024
•
14 min read
Introduction
Integrating payment gateways with Acumatica enables automated payment processing for sales orders, customer payments, and refunds. This guide covers the integration architecture and implementation for major payment processors.
Supported Gateways
Acumatica supports multiple payment gateways including:
- Stripe
- PayPal
- Authorize.Net
- Adyen
- Chase Paymentech
- Custom gateway integrations
Integration Architecture
The payment integration uses Acumatica's payment gateway API:
┌─────────────┐ ┌──────────────┐ ┌────────────────┐
│ Acumatica │────▶│ Payment API │────▶│ Payment Gateway│
│ ERP │◀────│ Wrapper │◀────│ (Stripe/PayPal)│
└─────────────┘ └──────────────┘ └────────────────┘
Key components:
- Payment connector - Handles gateway-specific logic
- Token vault - Stores payment method tokens
- Transaction manager - Processes payments and refunds
- Webhooks handler - Processes async events
Stripe Integration
class StripePaymentGateway {
constructor(apiKey) {
this.stripe = new Stripe(apiKey);
}
async createPaymentIntent(amount, currency, customerId) {
const intent = await this.stripe.paymentIntents.create({
amount: Math.round(amount * 100),
currency: currency,
customer: customerId,
automatic_payment_methods: {
enabled: true
}
});
return {
clientSecret: intent.client_secret,
paymentIntentId: intent.id
};
}
async confirmPayment(paymentIntentId) {
const intent = await this.stripe.paymentIntents.confirm(paymentIntentId);
return {
status: intent.status,
amount: intent.amount / 100
};
}
}
Payment Capture
async function captureAuthorizedPayment(paymentId, gateway) {
const captureData = {
PaymentID: { "value": paymentId },
Action: { "value": "Capture" }
};
const result = await updatePayment(
baseUrl,
token,
"AR303000",
captureData
);
await gateway.capturePayment(result.RefNbr);
return result;
}
Refunds
async function processRefund(paymentId, amount, reason) {
// Get original payment details
const payment = await getPaymentDetails(paymentId);
// Create refund via gateway
const refund = await gateway.refund({
paymentIntentId: payment.gatewayRef,
amount: amount,
reason: reason
});
// Record refund in Acumatica
const refundDoc = {
CustomerID: { "value": payment.CustomerID },
Type: { "value": "CreditMemo" },
Amount: { "value": amount },
RefNbr: { "value": refund.id }
};
await createAcumaticaRefund(refundDoc);
}
Summary
Integrating payment gateways with Acumatica enables automated payment processing, reduces manual effort, and improves cash flow visibility. By implementing the patterns in this guide, you can process payments, handle authorizations, captures, and refunds seamlessly.
For more information, check out our other tutorials on Shopify Integration and CRM Integration.