Authorize.net Integration ​
Bridge Payments provides seamless integration with Authorize.net, a leading payment gateway trusted by businesses worldwide.
Overview ​
Authorize.net integration supports:
- ✅ Card Payments - Credit/debit card processing
- ✅ Payment Profiles - Tokenized card storage (CIM)
- ✅ Subscriptions - Recurring billing (ARB)
- ✅ Accept.js - Secure tokenization
- ✅ eCheck - Bank account payments
- ✅ Fraud Detection - Advanced fraud protection
- ✅ Webhooks - Real-time event notifications
Configuration ​
1. Get Authorize.net API Credentials ​
- Sign up at authorize.net
- Navigate to Account → Settings → API Credentials & Keys
- Copy your API Login ID and Transaction Key
2. Configure Bridge Payments ​
In your Bridge Payments instance (Pubflow dashboard):
bash
# Authorize.net API Credentials
AUTHORIZE_NET_API_LOGIN_ID=your_api_login_id
AUTHORIZE_NET_TRANSACTION_KEY=your_transaction_key
# Environment (sandbox or production)
AUTHORIZE_NET_ENVIRONMENT=sandbox # or "production"
# Public Client Key (for Accept.js)
AUTHORIZE_NET_PUBLIC_CLIENT_KEY=your_public_client_key3. Configure Webhooks ​
Set up webhook endpoint in Authorize.net dashboard:
Webhook URL:
https://your-instance.pubflow.com/bridge-payment/webhooks/authorize-netEvents to Subscribe:
net.authorize.payment.authorization.creatednet.authorize.payment.capture.creatednet.authorize.payment.refund.creatednet.authorize.payment.void.creatednet.authorize.customer.subscription.creatednet.authorize.customer.subscription.updatednet.authorize.customer.subscription.cancelled
Payment Flows ​
Card Payment ​
Step 1: Create Payment Intent ​
bash
curl -X POST "https://your-instance.pubflow.com/bridge-payment/payments/intents" \
-H "Content-Type: application/json" \
-H "X-Session-ID: session_abc123" \
-d '{
"total_cents": 2000,
"currency": "USD",
"provider_id": "authorize_net",
"concept": "Premium Plan"
}'Step 2: Tokenize Card (Frontend with Accept.js) ​
html
<script type="text/javascript" src="https://jstest.authorize.net/v1/Accept.js"></script>
<script>
function sendPaymentDataToAnet() {
const authData = {
clientKey: 'your_public_client_key',
apiLoginID: 'your_api_login_id'
};
const cardData = {
cardNumber: document.getElementById('cardNumber').value,
month: document.getElementById('expMonth').value,
year: document.getElementById('expYear').value,
cardCode: document.getElementById('cvv').value
};
const secureData = { authData, cardData };
Accept.dispatchData(secureData, responseHandler);
}
function responseHandler(response) {
if (response.messages.resultCode === 'Error') {
console.error('Tokenization failed');
} else {
const paymentToken = response.opaqueData.dataValue;
// Send token to your backend
confirmPayment(paymentToken);
}
}
</script>Step 3: Confirm Payment with Token ​
bash
curl -X POST "https://your-instance.pubflow.com/bridge-payment/payments/intents/pay_123/confirm" \
-H "Content-Type: application/json" \
-H "X-Session-ID: session_abc123" \
-d '{
"payment_token": "eyJjb2RlIjoiNTBfMl8wNjAwMDUzMjY..."
}'Direct Card Payment (Development Only) ​
bash
curl -X POST "https://your-instance.pubflow.com/bridge-payment/payments/intents" \
-H "Content-Type: application/json" \
-H "X-Session-ID: session_abc123" \
-d '{
"total_cents": 2000,
"currency": "USD",
"provider_id": "authorize_net",
"card_number": "4111111111111111",
"card_exp_month": "12",
"card_exp_year": "2025",
"card_cvc": "123",
"concept": "Product Purchase"
}'PCI Compliance
Direct card data should only be used in development. Use Accept.js tokenization in production.
Payment with Saved Method ​
Step 1: Create Payment Profile ​
bash
curl -X POST "https://your-instance.pubflow.com/bridge-payment/payment-methods" \
-H "Content-Type: application/json" \
-H "X-Session-ID: session_abc123" \
-d '{
"provider_id": "authorize_net",
"payment_token": "eyJjb2RlIjoiNTBfMl8wNjAwMDUzMjY...",
"alias": "My Visa Card"
}'Step 2: Charge Saved Method ​
bash
curl -X POST "https://your-instance.pubflow.com/bridge-payment/payments/intents" \
-H "Content-Type: application/json" \
-H "X-Session-ID: session_abc123" \
-d '{
"total_cents": 2000,
"currency": "USD",
"provider_id": "authorize_net",
"payment_method_id": "pm_123",
"concept": "Monthly Subscription"
}'Subscription (ARB) ​
bash
curl -X POST "https://your-instance.pubflow.com/bridge-payment/subscriptions" \
-H "Content-Type: application/json" \
-H "X-Session-ID: session_abc123" \
-d '{
"customer_id": "cust_123",
"payment_method_id": "pm_123",
"provider_id": "authorize_net",
"total_cents": 2000,
"currency": "USD",
"billing_interval": "monthly",
"trial_days": 14,
"concept": "Premium Monthly Plan"
}'Frontend Integration ​
React with Accept.js ​
jsx
import { useEffect, useState } from 'react';
function AuthorizeNetPayment({ amount }) {
const [loading, setLoading] = useState(false);
const [paymentIntentId, setPaymentIntentId] = useState('');
useEffect(() => {
// Load Accept.js
const script = document.createElement('script');
script.src = 'https://jstest.authorize.net/v1/Accept.js';
script.async = true;
document.body.appendChild(script);
// Create payment intent
fetch('/bridge-payment/payments/intents', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Session-ID': sessionId
},
body: JSON.stringify({
total_cents: amount,
currency: 'USD',
provider_id: 'authorize_net'
})
})
.then(res => res.json())
.then(data => setPaymentIntentId(data.id));
}, [amount]);
const handleSubmit = (e) => {
e.preventDefault();
setLoading(true);
const authData = {
clientKey: process.env.REACT_APP_AUTHORIZE_NET_CLIENT_KEY,
apiLoginID: process.env.REACT_APP_AUTHORIZE_NET_API_LOGIN_ID
};
const cardData = {
cardNumber: e.target.cardNumber.value,
month: e.target.expMonth.value,
year: e.target.expYear.value,
cardCode: e.target.cvv.value
};
const secureData = { authData, cardData };
window.Accept.dispatchData(secureData, async (response) => {
if (response.messages.resultCode === 'Error') {
alert('Tokenization failed');
setLoading(false);
} else {
const paymentToken = response.opaqueData.dataValue;
// Confirm payment
await fetch(`/bridge-payment/payments/intents/${paymentIntentId}/confirm`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Session-ID': sessionId
},
body: JSON.stringify({ payment_token: paymentToken })
});
alert('Payment successful!');
setLoading(false);
}
});
};
return (
<form onSubmit={handleSubmit}>
<input name="cardNumber" placeholder="Card Number" required />
<input name="expMonth" placeholder="MM" required />
<input name="expYear" placeholder="YYYY" required />
<input name="cvv" placeholder="CVV" required />
<button disabled={loading}>
{loading ? 'Processing...' : 'Pay Now'}
</button>
</form>
);
}Features ​
eCheck Payments ​
Accept bank account payments:
bash
curl -X POST "/bridge-payment/payments/intents" \
-d '{
"total_cents": 2000,
"currency": "USD",
"provider_id": "authorize_net",
"payment_type": "echeck",
"account_number": "123456789",
"routing_number": "111000025",
"account_type": "checking",
"name_on_account": "John Doe"
}'Fraud Detection ​
Authorize.net includes built-in fraud detection:
- Address Verification Service (AVS)
- Card Code Verification (CVV)
- Fraud Detection Suite (FDS)
Testing ​
Sandbox Mode ​
Use sandbox credentials for testing:
bash
AUTHORIZE_NET_ENVIRONMENT=sandbox
AUTHORIZE_NET_API_LOGIN_ID=sandbox_login_id
AUTHORIZE_NET_TRANSACTION_KEY=sandbox_transaction_keyTest Cards ​
| Card Number | Type | Result |
|---|---|---|
4111111111111111 | Visa | Approved |
5424000000000015 | Mastercard | Approved |
370000000000002 | Amex | Approved |
4222222222222 | Visa | Declined |
Expiration: Any future date
CVV: Any 3 digits (4 for Amex)
Best Practices ​
- Use Accept.js - Secure tokenization for PCI compliance
- Enable Fraud Detection - Protect against fraudulent transactions
- Test in Sandbox - Use sandbox mode for development
- Store Payment Profiles - Use CIM for recurring payments
- Monitor Dashboard - Track payments and chargebacks
Next Steps ​
- Payments API - Complete API reference
- Payment Methods API - Manage payment profiles
- Subscriptions API - Recurring billing (ARB)
- Webhooks API - Event handling