These recipes provide ready-to-use approval workflows for financial operations, designed with compliance and security in mind.
Refund Processing
Wire Transfers
Payment Processing
Credit Limit Changes
Refund Processing
Enable safe refund processing with automatic approvals for small amounts and required oversight for larger refunds.const processRefund = needsHumanApproval({
type: 'sync',
title: 'Refund Request',
ask: (args) => `Approve refund of $${args.amount} for order ${args.orderId}?`,
autoApprove: async (args) => args.amount < 100
})
// Usage
await processRefund({
orderId: '1234',
amount: 150,
reason: 'Defective product'
})
- Customer refund requests
- Order cancellations
- Service credits
- Complaint resolutions
- Set appropriate auto-approval thresholds
- Include order context
- Maintain audit trail
- Consider customer history
Wire Transfers
Secure wire transfer processing with multi-approver requirements and business hour restrictions.const processWireTransfer = needsHumanApproval({
type: 'sync',
title: 'Wire Transfer',
ask: (args) => `Approve wire transfer of $${args.amount} to ${args.recipient}?`,
// Require approval outside business hours
shouldSeekApprovals: async (args) => {
const hour = new Date().getHours();
return hour < 9 || hour > 17;
}
})
For wire transfers over $50,000, approvals from both Financial Controller and Treasury Manager are required.
Payment Processing
Handle high-value payment approvals with fraud detection integration.const processPayment = needsHumanApproval({
type: 'sync',
title: 'Payment Processing',
ask: (args) => {
const fraudAlert = args.fraudScore > 70 ? '⚠️ HIGH RISK: ' : '';
return `${fraudAlert}Approve payment of $${args.amount} for transaction ${args.transactionId}`;
},
approvalArguments: {
amount: {
type: 'number',
value: args.amount,
label: 'Payment Amount',
editable: false
},
fraudScore: {
type: 'number',
value: args.fraudScore,
label: 'Fraud Risk Score',
editable: false
},
paymentMethod: {
type: 'string',
value: args.paymentMethod,
label: 'Payment Method',
editable: false
},
customerHistory: {
type: 'longString',
value: args.transactionHistory,
label: 'Customer Transaction History',
editable: false
}
},
// Require approval for high-risk transactions
shouldSeekApprovals: async (args) => {
return args.fraudScore > 50 || args.amount > 10000;
}
})
- Fraud score above threshold
- Unusual transaction amount
- New payment method
- Geographic location
Credit Limit Changes
Manage credit limit modifications with risk assessment.const modifyCreditLimit = needsHumanApproval({
type: 'async',
title: 'Credit Limit Modification',
ask: (args) => `Review credit limit change for account ${args.accountId}`,
approvalArguments: {
currentLimit: {
type: 'number',
value: args.currentLimit,
label: 'Current Limit',
editable: false
},
proposedLimit: {
type: 'number',
value: args.proposedLimit,
label: 'Proposed Limit',
editable: true
},
creditScore: {
type: 'number',
value: args.creditScore,
label: 'Credit Score',
editable: false
},
paymentHistory: {
type: 'longString',
value: args.paymentHistory,
label: 'Payment History',
editable: false
}
},
// Auto-approve small increases for good customers
autoApprove: async (args) => {
const increasePercent = (args.proposedLimit - args.currentLimit) / args.currentLimit * 100;
return increasePercent <= 10 && args.creditScore > 700;
}
})
Next Steps