How to Use GitHub Copilot with MoneyGraph for Payment Integrations
Step-by-step guide to using GitHub Copilot with MoneyGraph SDK. Learn how Copilot understands KYC compliance, FX quotes, and cross-border payouts automatically.
GitHub Copilot is the world's most widely used AI coding assistant. With MoneyGraph SDK v2.2, Copilot now understands how to build compliant payment integrations without hallucinating endpoints or skipping critical compliance checks.
What Copilot Learns from MoneyGraph
When you install our SDK, Copilot reads .github/copilot-instructions.md and learns:
| What Copilot Learns | Why It Matters |
|---|---|
| Never use raw fetch() | Use SDK methods instead of API calls |
| The Golden Path | Correct sequence: Initialize → KYC → Quote → Confirm → Payout |
| Dual-Mode Awareness | sk_test_* = sandbox, sk_live_* = production |
| Compliance First | Always check KYC before payouts |
| Environment Variables | Never hardcode API keys |
1. Never Use Raw Fetch
Copilot will never generate code like this:
// ❌ Copilot won't do this anymore
const response = await fetch('https://api.moneygraph.ai/v1/payouts');Instead, it generates:
// ✅ Copilot generates this
import { MoneyGraph } from '@moneygraph/sdk';
const mg = new MoneyGraph({ apiKey: process.env.MONEYGRAPH_API_KEY });2. The Golden Path
Copilot understands the correct sequence for payment integrations:
- Initialize — Create client with API key
- Onboard — Create customer and complete KYC
- Quote — Get FX rate (valid 2 minutes)
- Confirm — Lock the rate
- Payout — Send money
3. Dual-Mode Awareness
Copilot knows that sk_test_* keys enable sandbox mode with mock data, while sk_live_* keys trigger real transactions.
Setup (30 Seconds)
npm install @moneygraph/sdkThat's it. Copilot automatically reads the instructions file.
Quick Start Prompt
Copy this into your editor to get started:
// TODO: Install MoneyGraph SDK and create a function that:
// 1. Accepts a customer ID and amount in USD
// 2. Checks if the customer's KYC is approved
// 3. Gets an FX quote to convert USD to Nigerian Naira (NGN)
// 4. Confirms the quote to lock the rate
// 5. Creates a payout to a Nigerian bank account
// Use the MoneyGraph SDK patternsWatch Copilot generate compliant code with KYC checks, FX handling, and proper error management!
Try It: Prompt Examples
Open a TypeScript file and try these prompts:
Prompt: "Create a function to send $100 to Nigeria"
Copilot generates: ```typescript import { MoneyGraph } from '@moneygraph/sdk';
async function sendToNigeria(customerId: string) { const mg = new MoneyGraph({ apiKey: process.env.MONEYGRAPH_API_KEY });
// Check KYC status first const status = await mg.customers.kyc.canPayout(customerId); if (!status.allowed) { throw new Error('KYC not approved'); }
// Get quote and confirm const quote = await mg.fx.quote({ from: 'USD', to: 'NGN', amount: 100 }); await mg.fx.confirm(quote.id);
// Send payout return mg.payouts.create({ quote_id: quote.id, customer_id: customerId, recipient: { name: 'Recipient Name', bank_code: '058', account_number: '0123456789', }, }); } ```
Notice how Copilot:
- ✅ Used the SDK (not raw fetch)
- ✅ Checked KYC status first
- ✅ Followed Quote → Confirm → Payout flow
- ✅ Used environment variables for API key
Advanced: Copilot Chat
Use Copilot Chat for complex questions:
| Question | What Copilot Explains |
|---|---|
| "How do I handle a QUOTE_EXPIRED error?" | Error handling patterns with retry logic |
| "What's the difference between mg.payouts.create and mg.payouts.swift.create?" | Namespace differences and when to use each |
| "Show me how to issue a virtual card" | Complete card issuance flow with KYC checks |
Copilot references our SDK patterns from the instructions file for accurate, compliant code.
Troubleshooting
| Issue | Solution |
|---|---|
| Copilot ignores the instructions | Ensure `node_modules/@moneygraph/sdk` exists in your workspace. Copilot reads instructions from installed packages. |
| Copilot still uses raw fetch() | Add a comment `// Use MoneyGraph SDK` above your code. This primes Copilot to use SDK patterns. |
| SDK methods not autocompleting | Run `npm install @moneygraph/sdk` and restart your editor to reload TypeScript definitions. |
Next Steps
Resources:
- MoneyGraph SDK Documentation - Complete integration guides and API reference
- GitHub Copilot Setup - Official Copilot documentation
- SDK Installation Guide - Get started in 5 minutes
Ready to Get Started?
Install MoneyGraph SDK and start building AI-native payment applications today