@cashfreepayments/agent-skills 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +214 -0
  2. package/bin/cashfree.js +2 -0
  3. package/dist/config.d.ts +50 -0
  4. package/dist/config.d.ts.map +1 -0
  5. package/dist/config.js +24 -0
  6. package/dist/config.js.map +1 -0
  7. package/dist/generators/index.d.ts +2 -0
  8. package/dist/generators/index.d.ts.map +1 -0
  9. package/dist/generators/index.js +2 -0
  10. package/dist/generators/index.js.map +1 -0
  11. package/dist/generators/utils.d.ts +14 -0
  12. package/dist/generators/utils.d.ts.map +1 -0
  13. package/dist/generators/utils.js +34 -0
  14. package/dist/generators/utils.js.map +1 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +156 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/templates/crossBorder.d.ts +5 -0
  20. package/dist/templates/crossBorder.d.ts.map +1 -0
  21. package/dist/templates/crossBorder.js +10 -0
  22. package/dist/templates/crossBorder.js.map +1 -0
  23. package/dist/templates/crossBorder.md +264 -0
  24. package/dist/templates/payouts.d.ts +5 -0
  25. package/dist/templates/payouts.d.ts.map +1 -0
  26. package/dist/templates/payouts.js +10 -0
  27. package/dist/templates/payouts.js.map +1 -0
  28. package/dist/templates/payouts.md +332 -0
  29. package/dist/templates/pg.d.ts +5 -0
  30. package/dist/templates/pg.d.ts.map +1 -0
  31. package/dist/templates/pg.js +10 -0
  32. package/dist/templates/pg.js.map +1 -0
  33. package/dist/templates/pg.md +501 -0
  34. package/dist/templates/secure-id.d.ts +5 -0
  35. package/dist/templates/secure-id.d.ts.map +1 -0
  36. package/dist/templates/secure-id.js +10 -0
  37. package/dist/templates/secure-id.js.map +1 -0
  38. package/dist/templates/secure-id.md +215 -0
  39. package/dist/templates/subscriptions.d.ts +5 -0
  40. package/dist/templates/subscriptions.d.ts.map +1 -0
  41. package/dist/templates/subscriptions.js +10 -0
  42. package/dist/templates/subscriptions.js.map +1 -0
  43. package/dist/templates/subscriptions.md +193 -0
  44. package/package.json +49 -0
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: Cashfree Cross Border
3
+ description: Use this to see Cross Border documentation and API references
4
+ ---
5
+
6
+ # Cashfree Cross Border - Collect from India Integration
7
+
8
+ ## Overview
9
+ This integration enables foreign merchants (based outside India) to collect payments from Indian customers using Indian payment methods (UPI, Cards, Net Banking, etc.). Funds are settled to the merchant's overseas bank account.
10
+
11
+ ## API Base URLs
12
+ - **Sandbox**: `https://sandbox.cashfree.com/`
13
+ - **Production**: `https://api.cashfree.com/`
14
+
15
+ ## Authentication Headers
16
+ ```
17
+ x-client-id: <your_client_id>
18
+ x-client-secret: <your_client_secret>
19
+ x-api-version: 2025-01-01
20
+ ```
21
+
22
+ ## Backend Integration
23
+
24
+ ### 1. Create Order
25
+ **Endpoint**: `POST /pg/orders`
26
+
27
+ ```javascript
28
+ // Node.js example
29
+ const createOrder = async (orderData) => {
30
+ const response = await fetch('https://sandbox.cashfree.com/pg/orders', {
31
+ method: 'POST',
32
+ headers: {
33
+ 'x-client-id': process.env.CASHFREE_CLIENT_ID,
34
+ 'x-client-secret': process.env.CASHFREE_CLIENT_SECRET,
35
+ 'x-api-version': '2025-01-01',
36
+ 'Content-Type': 'application/json'
37
+ },
38
+ body: JSON.stringify({
39
+ order_id: orderData.orderId,
40
+ order_amount: orderData.amount,
41
+ order_currency: 'INR',
42
+ customer_details: {
43
+ customer_id: orderData.customerId,
44
+ customer_email: orderData.email,
45
+ customer_phone: orderData.phone
46
+ },
47
+ order_meta: {
48
+ return_url: orderData.returnUrl,
49
+ notify_url: orderData.webhookUrl
50
+ }
51
+ })
52
+ });
53
+ return response.json();
54
+ };
55
+ ```
56
+
57
+ ### 2. Upload Payment Verification Details
58
+ **Endpoint**: `POST /import/transactions/{cf_payment_id}/details`
59
+
60
+ Required for regulatory compliance. Upload documents after successful payment.
61
+
62
+ ```javascript
63
+ const uploadVerificationDetails = async (cfPaymentId, details) => {
64
+ const response = await fetch(
65
+ `https://api.cashfree.com/import/transactions/${cfPaymentId}/details`,
66
+ {
67
+ method: 'POST',
68
+ headers: {
69
+ 'x-client-id': process.env.CASHFREE_CLIENT_ID,
70
+ 'x-client-secret': process.env.CASHFREE_CLIENT_SECRET,
71
+ 'x-api-version': '2025-01-01',
72
+ 'Content-Type': 'application/json'
73
+ },
74
+ body: JSON.stringify({
75
+ goods_description: details.goodsDescription,
76
+ invoice_number: details.invoiceNumber,
77
+ importer_name: details.importerName,
78
+ importer_address: details.importerAddress,
79
+ country_of_origin: details.countryOfOrigin,
80
+ // For Physical Goods:
81
+ shipment_date: details.shipmentDate,
82
+ port_of_loading: details.portOfLoading,
83
+ awb_number: details.awbNumber,
84
+ hs_code: details.hsCode
85
+ })
86
+ }
87
+ );
88
+ return response.json();
89
+ };
90
+ ```
91
+
92
+ ### 3. Get Payment Verification Status
93
+ **Endpoint**: `GET /import/transactions/{cf_payment_id}`
94
+
95
+ ```javascript
96
+ const getVerificationStatus = async (cfPaymentId) => {
97
+ const response = await fetch(
98
+ `https://api.cashfree.com/import/transactions/${cfPaymentId}`,
99
+ {
100
+ headers: {
101
+ 'x-client-id': process.env.CASHFREE_CLIENT_ID,
102
+ 'x-client-secret': process.env.CASHFREE_CLIENT_SECRET,
103
+ 'x-api-version': '2025-01-01'
104
+ }
105
+ }
106
+ );
107
+ return response.json();
108
+ };
109
+ ```
110
+
111
+ ### 4. Get Settlement Details
112
+ **Endpoint**: `GET /import/settlements`
113
+
114
+ ## Frontend Integration
115
+
116
+ ### Cashfree JS SDK Checkout
117
+ ```html
118
+ <script src="https://sdk.cashfree.com/js/v3/cashfree.js"></script>
119
+
120
+ <script>
121
+ const cashfree = Cashfree({ mode: "sandbox" }); // or "production"
122
+
123
+ function initiatePayment(paymentSessionId) {
124
+ cashfree.checkout({
125
+ paymentSessionId: paymentSessionId,
126
+ redirectTarget: "_modal" // or "_self" for redirect
127
+ }).then((result) => {
128
+ if (result.error) {
129
+ console.error("Payment error:", result.error.message);
130
+ }
131
+ if (result.paymentDetails) {
132
+ console.log("Payment completed:", result.paymentDetails);
133
+ }
134
+ });
135
+ }
136
+ </script>
137
+ ```
138
+
139
+ ## Webhook Integration
140
+
141
+ ### Configure Webhook Endpoint
142
+ Register your webhook URL in the Cashfree Dashboard under Developers > Webhooks.
143
+
144
+ ### Webhook Events for Cross Border
145
+ 1. **PAYMENT_VERIFICATION_UPDATE** - Payment verification status changes
146
+ 2. **ICA_SETTLEMENT_UPDATE** - Settlement status updates
147
+
148
+ ### Webhook Handler with Signature Verification
149
+
150
+ ```javascript
151
+ // Node.js/Express webhook handler
152
+ const crypto = require('crypto');
153
+
154
+ app.post('/webhook/cashfree', express.raw({ type: 'application/json' }), (req, res) => {
155
+ const signature = req.headers['x-webhook-signature'];
156
+ const timestamp = req.headers['x-webhook-timestamp'];
157
+ const rawBody = req.body.toString();
158
+
159
+ // Verify signature
160
+ const signedPayload = timestamp + rawBody;
161
+ const expectedSignature = crypto
162
+ .createHmac('sha256', process.env.CASHFREE_CLIENT_SECRET)
163
+ .update(signedPayload)
164
+ .digest('base64');
165
+
166
+ if (signature !== expectedSignature) {
167
+ return res.status(401).send('Invalid signature');
168
+ }
169
+
170
+ const payload = JSON.parse(rawBody);
171
+
172
+ // Handle different webhook types
173
+ switch (payload.type) {
174
+ case 'PAYMENT_VERIFICATION_UPDATE':
175
+ handleVerificationUpdate(payload.data);
176
+ break;
177
+ case 'ICA_SETTLEMENT_UPDATE':
178
+ handleSettlementUpdate(payload.data);
179
+ break;
180
+ case 'PAYMENT_SUCCESS_WEBHOOK':
181
+ handlePaymentSuccess(payload.data);
182
+ break;
183
+ }
184
+
185
+ res.status(200).send('OK');
186
+ });
187
+
188
+ function handleVerificationUpdate(data) {
189
+ // data contains: cf_payment_id, payment_status, payment_verification_status,
190
+ // payment_verification_expiry, required_details[]
191
+ console.log('Verification status:', data.payment_verification_status);
192
+ // ACTION_REQUIRED, IN_REVIEW, VERIFIED, REJECTED
193
+ }
194
+
195
+ function handleSettlementUpdate(data) {
196
+ // data contains: cf_ica_settlement_id, settlement_amount_inr,
197
+ // settlement_foreign_currency_details, status, settlement_utr
198
+ console.log('Settlement status:', data.status);
199
+ }
200
+ ```
201
+
202
+ ### Payment Verification Webhook Payload
203
+ ```json
204
+ {
205
+ "data": {
206
+ "order_id": "order_123",
207
+ "cf_payment_id": 5114910634577,
208
+ "payment_status": "SUCCESS",
209
+ "payment_verification_status": "ACTION_REQUIRED",
210
+ "payment_verification_expiry": "2024-07-12T15:19:42+05:30",
211
+ "required_details": [
212
+ { "doc_name": "goods_description", "doc_type": "VALUE", "doc_status": "ACTION_REQUIRED" },
213
+ { "doc_name": "invoice_file", "doc_type": "DOCUMENT", "doc_status": "IN_REVIEW" }
214
+ ]
215
+ },
216
+ "event_time": "2024-07-12T13:39:42+05:30",
217
+ "type": "PAYMENT_VERIFICATION_UPDATE"
218
+ }
219
+ ```
220
+
221
+ ### ICA Settlement Webhook Payload
222
+ ```json
223
+ {
224
+ "data": {
225
+ "cf_ica_settlement_id": 12,
226
+ "collection_amount_inr": 604854.0,
227
+ "settlement_amount_inr": 243651.95,
228
+ "settlement_foreign_currency_details": {
229
+ "settlement_amount_fcy": null,
230
+ "settlement_currency": "USD",
231
+ "settlement_forex_rate": null
232
+ },
233
+ "status": "NOT_INITIATED"
234
+ },
235
+ "event_time": "2024-10-03T13:27:36+05:30",
236
+ "type": "ICA_SETTLEMENT_UPDATE"
237
+ }
238
+ ```
239
+
240
+ ## Key APIs Summary
241
+ | API | Endpoint | Purpose |
242
+ |-----|----------|---------|
243
+ | Create Order | `POST /pg/orders` | Create payment order |
244
+ | Order Pay | `POST /pg/orders/{order_id}/pay` | Process payment |
245
+ | Get Payment | `GET /pg/orders/{order_id}/payments/{cf_payment_id}` | Verify payment status |
246
+ | Upload Verification | `POST /import/transactions/{cf_payment_id}/details` | Upload compliance docs |
247
+ | Get Verification | `GET /import/transactions/{cf_payment_id}` | Check verification status |
248
+ | Get Settlement | `GET /import/settlements` | Get settlement details |
249
+
250
+ ## Important Notes
251
+ - Always verify webhook signatures before processing
252
+ - Upload verification documents promptly after successful payments
253
+ - Settlement happens in foreign currency to overseas bank account
254
+ - Settlements can be as fast as T+2 days
255
+
256
+ ---
257
+
258
+ This skills file covers the Cross Border - Collect from India integration based on the [Overview](/payments/international-payments/collect-from-india/overview) and [Webhooks](/api-reference/payments/latest/international-payments/collect-from-india/import-webhooks) documentation.
259
+
260
+ ```suggestions
261
+ (Collect from India Overview)[/payments/international-payments/collect-from-india/overview]
262
+ (Import Webhooks)[/api-reference/payments/latest/international-payments/collect-from-india/import-webhooks]
263
+ (API Overview)[/api-reference/payments/latest/international-payments/collect-from-india/overview]
264
+ ```
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Payouts skill template
3
+ */
4
+ export declare function getPayoutsSkillTemplate(): string;
5
+ //# sourceMappingURL=payouts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payouts.d.ts","sourceRoot":"","sources":["../../src/templates/payouts.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAGhD"}
@@ -0,0 +1,10 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ /**
4
+ * Payouts skill template
5
+ */
6
+ export function getPayoutsSkillTemplate() {
7
+ const templatePath = path.join(__dirname, "payouts.md");
8
+ return fs.readFileSync(templatePath, "utf8");
9
+ }
10
+ //# sourceMappingURL=payouts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payouts.js","sourceRoot":"","sources":["../../src/templates/payouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACnC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACxD,OAAO,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,332 @@
1
+ ---
2
+ name: Cashfree Payouts
3
+ description: Use this to see Payouts documentation and API references
4
+ ---
5
+
6
+ # Cashfree Payouts Integration
7
+
8
+ ## Overview
9
+ Cashfree Payouts enables instant fund transfers to bank accounts, UPI IDs, cards, and wallets. This is a **backend-only integration** - no frontend SDK is required.
10
+
11
+ ---
12
+
13
+ ## Environment Configuration
14
+
15
+ ```
16
+ # Environment URLs
17
+ PRODUCTION_URL_V2=https://api.cashfree.com/payout
18
+ SANDBOX_URL_V2=https://sandbox.cashfree.com/payout
19
+ PRODUCTION_URL_V1=https://payout-api.cashfree.com
20
+ SANDBOX_URL_V1=https://payout-gamma.cashfree.com
21
+
22
+ # Required Headers
23
+ x-client-id: <YOUR_CLIENT_ID>
24
+ x-client-secret: <YOUR_CLIENT_SECRET>
25
+ x-api-version: 2024-01-01
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Authentication
31
+
32
+ ### V1 API (Bearer Token)
33
+ Call `/payout/v1/authorize` to get a Bearer token (valid for 6 minutes):
34
+
35
+ ```bash
36
+ curl -X POST 'https://payout-api.cashfree.com/payout/v1/authorize' \
37
+ -H 'X-Client-Id: <CLIENT_ID>' \
38
+ -H 'X-Client-Secret: <CLIENT_SECRET>'
39
+ ```
40
+
41
+ **Response:**
42
+ ```json
43
+ {
44
+ "status": "SUCCESS",
45
+ "message": "Token generated",
46
+ "subCode": "200",
47
+ "data": { "token": "eyJ0eXA...fWStg", "expiry": 1564130052 }
48
+ }
49
+ ```
50
+
51
+ ### V2 API (Direct Authentication)
52
+ Use `x-client-id` and `x-client-secret` headers directly - no token needed.
53
+
54
+ ### 2FA Requirements
55
+ - **IP Whitelisting**: Whitelist up to 25 IPv4 addresses in Dashboard > Developers > Two-Factor Authentication
56
+ - **Public Key Signature**: If no static IP, generate signature using RSA encryption with `X-Cf-Signature` header
57
+
58
+ ---
59
+
60
+ ## Backend API Integration
61
+
62
+ ### 1. Create Beneficiary (V2)
63
+
64
+ ```bash
65
+ curl -X POST 'https://sandbox.cashfree.com/payout/beneficiary' \
66
+ -H 'x-client-id: <CLIENT_ID>' \
67
+ -H 'x-client-secret: <CLIENT_SECRET>' \
68
+ -H 'x-api-version: 2024-01-01' \
69
+ -H 'Content-Type: application/json' \
70
+ -d '{
71
+ "beneficiary_id": "JOHN18011343",
72
+ "beneficiary_name": "John Doe",
73
+ "beneficiary_instrument_details": {
74
+ "bank_account_number": "00111122233",
75
+ "bank_ifsc": "HDFC0000001",
76
+ "vpa": "test@upi"
77
+ },
78
+ "beneficiary_contact_details": {
79
+ "beneficiary_email": "johndoe@cashfree.com",
80
+ "beneficiary_phone": "9876543210",
81
+ "beneficiary_address": "177A Bleecker Street",
82
+ "beneficiary_city": "Bangalore",
83
+ "beneficiary_state": "Karnataka",
84
+ "beneficiary_postal_code": "560001"
85
+ }
86
+ }'
87
+ ```
88
+
89
+ ### 2. Standard Transfer (V2)
90
+
91
+ ```bash
92
+ curl -X POST 'https://sandbox.cashfree.com/payout/transfers' \
93
+ -H 'x-client-id: <CLIENT_ID>' \
94
+ -H 'x-client-secret: <CLIENT_SECRET>' \
95
+ -H 'x-api-version: 2024-01-01' \
96
+ -H 'Content-Type: application/json' \
97
+ -d '{
98
+ "beneficiary_id": "JOHN18011343",
99
+ "amount": 100.00,
100
+ "transfer_id": "TRANSFER_001",
101
+ "transfer_mode": "banktransfer",
102
+ "remarks": "Payout for order"
103
+ }'
104
+ ```
105
+
106
+ **Transfer Modes:** `banktransfer`, `upi`, `imps`, `neft`, `rtgs`, `paytm`, `amazonpay`
107
+
108
+ ### 3. Direct Transfer (Without Pre-added Beneficiary)
109
+
110
+ ```bash
111
+ curl -X POST 'https://payout-api.cashfree.com/payout/v1/directTransfer' \
112
+ -H 'Authorization: Bearer <TOKEN>' \
113
+ -H 'Content-Type: application/json' \
114
+ -d '{
115
+ "amount": 100,
116
+ "transferId": "DIRECT_001",
117
+ "transferMode": "banktransfer",
118
+ "beneDetails": {
119
+ "bankAccount": "00111122233",
120
+ "ifsc": "HDFC0000001",
121
+ "name": "John Doe",
122
+ "phone": "9876543210",
123
+ "email": "johndoe@cashfree.com",
124
+ "address1": "Bangalore"
125
+ }
126
+ }'
127
+ ```
128
+
129
+ ### 4. Batch Transfer (V2)
130
+
131
+ ```bash
132
+ curl -X POST 'https://sandbox.cashfree.com/payout/transfers/batch' \
133
+ -H 'x-client-id: <CLIENT_ID>' \
134
+ -H 'x-client-secret: <CLIENT_SECRET>' \
135
+ -H 'x-api-version: 2024-01-01' \
136
+ -H 'Content-Type: application/json' \
137
+ -d '{
138
+ "batch_transfer_id": "BATCH_001",
139
+ "batch_format": "BANK_ACCOUNT",
140
+ "delete_bene": 1,
141
+ "batch": [
142
+ {
143
+ "transfer_id": "TXN_001",
144
+ "amount": 100,
145
+ "phone": "9876543210",
146
+ "bank_account": "00111122233",
147
+ "ifsc": "HDFC0000001",
148
+ "email": "user1@email.com",
149
+ "name": "User One"
150
+ }
151
+ ]
152
+ }'
153
+ ```
154
+
155
+ ### 5. Get Transfer Status (V2)
156
+
157
+ ```bash
158
+ curl -X GET 'https://sandbox.cashfree.com/payout/transfers/<transfer_id>' \
159
+ -H 'x-client-id: <CLIENT_ID>' \
160
+ -H 'x-client-secret: <CLIENT_SECRET>' \
161
+ -H 'x-api-version: 2024-01-01'
162
+ ```
163
+
164
+ ### 6. Get Balance
165
+
166
+ ```bash
167
+ curl -X GET 'https://payout-api.cashfree.com/payout/v1/getBalance' \
168
+ -H 'Authorization: Bearer <TOKEN>'
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Webhook Integration
174
+
175
+ ### Configure Webhooks
176
+ Dashboard > Payouts > Developers > Webhooks
177
+
178
+ ### Webhook Events
179
+
180
+ | Event | Description |
181
+ |-------|-------------|
182
+ | `TRANSFER_SUCCESS` | Transfer completed, account debited |
183
+ | `TRANSFER_FAILED` | Transfer attempt failed |
184
+ | `TRANSFER_REVERSED` | Bank reversed the transfer |
185
+ | `TRANSFER_ACKNOWLEDGED` | Bank confirmed credit to beneficiary |
186
+ | `TRANSFER_REJECTED` | Cashfree rejected the transfer |
187
+ | `LOW_BALANCE_ALERT` | Account balance below threshold |
188
+ | `CREDIT_CONFIRMATION` | Balance credited to account |
189
+ | `BENEFICIARY_INCIDENT` | Service disruption for beneficiary bank |
190
+
191
+ ### Sample Webhook Payload
192
+
193
+ ```json
194
+ {
195
+ "event": "TRANSFER_SUCCESS",
196
+ "transferId": "TRANSFER_001",
197
+ "referenceId": "123456",
198
+ "utr": "P16111765023806",
199
+ "acknowledged": 1,
200
+ "eventTime": "2024-01-15T10:30:00Z",
201
+ "signature": "base64_encoded_signature"
202
+ }
203
+ ```
204
+
205
+ ### Webhook Signature Verification
206
+
207
+ Verify using HMAC-SHA256 with your client secret:
208
+
209
+ ```javascript
210
+ // Node.js
211
+ const crypto = require("crypto");
212
+
213
+ function verifyWebhook(req) {
214
+ const timestamp = req.headers["x-webhook-timestamp"];
215
+ const rawBody = req.rawBody; // Must use raw body, not parsed JSON
216
+ const secretKey = "<client-secret>";
217
+
218
+ const signStr = timestamp + rawBody;
219
+ const computedSignature = crypto
220
+ .createHmac("sha256", secretKey)
221
+ .update(signStr)
222
+ .digest("base64");
223
+
224
+ return computedSignature === req.headers["x-webhook-signature"];
225
+ }
226
+ ```
227
+
228
+ ```python
229
+ # Python
230
+ import base64
231
+ import hashlib
232
+ import hmac
233
+
234
+ def verify_webhook(request):
235
+ raw_body = request.data.decode('utf-8')
236
+ timestamp = request.headers['x-webhook-timestamp']
237
+ signature = request.headers['x-webhook-signature']
238
+
239
+ sign_data = timestamp + raw_body
240
+ message = bytes(sign_data, 'utf-8')
241
+ secret = bytes("<client-secret>", 'utf-8')
242
+
243
+ computed = base64.b64encode(
244
+ hmac.new(secret, message, digestmod=hashlib.sha256).digest()
245
+ ).decode("utf-8")
246
+
247
+ return computed == signature
248
+ ```
249
+
250
+ ```java
251
+ // Java
252
+ import javax.crypto.Mac;
253
+ import javax.crypto.spec.SecretKeySpec;
254
+ import java.util.Base64;
255
+
256
+ public String verifySignature(HttpServletRequest request) throws Exception {
257
+ String payload = request.getReader().lines().collect(Collectors.joining());
258
+ String timestamp = request.getHeader("x-webhook-timestamp");
259
+ String data = timestamp + payload;
260
+
261
+ Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
262
+ SecretKeySpec secretKey = new SecretKeySpec(
263
+ "<client-secret>".getBytes(), "HmacSHA256"
264
+ );
265
+ sha256_HMAC.init(secretKey);
266
+
267
+ return Base64.getEncoder().encodeToString(
268
+ sha256_HMAC.doFinal(data.getBytes())
269
+ );
270
+ }
271
+ ```
272
+
273
+ ### IPs to Whitelist (for receiving webhooks)
274
+
275
+ **Sandbox:** `52.66.25.127`, `15.206.45.168`
276
+ **Production:** `52.66.101.190`, `3.109.102.144`, `18.60.134.245`, `18.60.183.142`
277
+ **Port:** `443` (HTTPS)
278
+
279
+ ---
280
+
281
+ ## Transfer Status Codes
282
+
283
+ | Status | Description |
284
+ |--------|-------------|
285
+ | `SUCCESS` | Transfer completed |
286
+ | `PENDING` | Awaiting bank confirmation |
287
+ | `FAILED` | Transfer failed |
288
+ | `REVERSED` | Bank reversed the transfer |
289
+ | `REJECTED` | Rejected by Cashfree |
290
+
291
+ ---
292
+
293
+ ## Error Handling
294
+
295
+ | Code | Message | Action |
296
+ |------|---------|--------|
297
+ | 403 | IP not whitelisted | Whitelist IP in dashboard |
298
+ | 403 | Token is not valid | Regenerate auth token |
299
+ | 404 | Beneficiary does not exist | Add beneficiary first |
300
+ | 409 | Transfer Id already exists | Use unique transfer ID |
301
+ | 412 | Not enough available balance | Add funds to account |
302
+ | 422 | Invalid IFSC code | Verify bank details |
303
+
304
+ ---
305
+
306
+ ## Sample Integration Kits
307
+
308
+ - **Node.js**: https://github.com/cashfree/cashfree-payout-node
309
+ - **Python**: https://github.com/cashfree/cashfree-payout-python
310
+ - **Java**: https://github.com/cashfree/cashfree-payout-java
311
+ - **PHP**: https://github.com/cashfree/cashfree-payout-php
312
+
313
+ ---
314
+
315
+ ## Best Practices
316
+
317
+ 1. Always verify webhook signatures before processing
318
+ 2. Implement idempotency - webhooks may be delivered multiple times
319
+ 3. Use unique `transfer_id` for each transaction
320
+ 4. Store `reference_id` and `utr` for reconciliation
321
+ 5. Handle `PENDING` status with polling or webhooks
322
+ 6. Keep API credentials secure - never expose in frontend code
323
+
324
+ ---
325
+
326
+ This skills file was created based on the Cashfree Payouts documentation. For more details, see:
327
+
328
+ ```suggestions
329
+ (Payouts API Overview)[/api-reference/payouts/overview]
330
+ (Webhooks V2)[/api-reference/payouts/v2/webhooks/webhooks-v2]
331
+ (Standard Transfer Integration)[/payouts/payouts/integrations/standard-transfer]
332
+ ```
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Payment Gateway skill template
3
+ */
4
+ export declare function getPGSkillTemplate(): string;
5
+ //# sourceMappingURL=pg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../../src/templates/pg.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C"}
@@ -0,0 +1,10 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ /**
4
+ * Payment Gateway skill template
5
+ */
6
+ export function getPGSkillTemplate() {
7
+ const templatePath = path.join(__dirname, "pg.md");
8
+ return fs.readFileSync(templatePath, "utf8");
9
+ }
10
+ //# sourceMappingURL=pg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg.js","sourceRoot":"","sources":["../../src/templates/pg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}