1+ const sh = `#!/bin/sh
2+ url="https://api.paystack.co/refundretry_with_customer_details/{id}"
3+ authorization="Authorization: Bearer YOUR_SECRET_KEY"
4+ content_type="Content-Type: application/json"
5+ data='{
6+ "refund_account_details": {
7+ "currency": "NGN",
8+ "account_number": "1234567890",
9+ "bank_id": "9"
10+ }
11+ }'
12+
13+ curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST`
14+
15+ const js = `const https = require('https')
16+
17+ const params = JSON.stringify({
18+ "refund_account_details": {
19+ "currency": "NGN",
20+ "account_number": "1234567890",
21+ "bank_id": "9"
22+ }
23+ })
24+
25+ const options = {
26+ hostname: 'api.paystack.co',
27+ port: 443,
28+ path: '/refund/retry_with_customer_details/{id}',
29+ method: 'POST',
30+ headers: {
31+ Authorization: 'Bearer SECRET_KEY',
32+ 'Content-Type': 'application/json'
33+ }
34+ }
35+
36+ const req = https.request(options, res => {
37+ let data = ''
38+
39+ res.on('data', (chunk) => {
40+ data += chunk
41+ });
42+
43+ res.on('end', () => {
44+ console.log(JSON.parse(data))
45+ })
46+ }).on('error', error => {
47+ console.error(error)
48+ })
49+
50+ req.write(params)
51+ req.end()`
52+
53+ const php = `<?php
54+ $url = "https://api.paystack.co/refund/retry_with_customer_details/{id}";
55+
56+ $fields = [
57+ 'transaction' => 1641,
58+ "refund_account_details" => [
59+ "currency" => "NGN",
60+ "account_number" => "1234567890",
61+ "bank_id" => "9"
62+ ]
63+ ];
64+
65+ $fields_string = http_build_query($fields);
66+
67+ //open connection
68+ $ch = curl_init();
69+
70+ //set the url, number of POST vars, POST data
71+ curl_setopt($ch, CURLOPT_URL, $url);
72+ curl_setopt($ch, CURLOPT_POST, true);
73+ curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
74+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
75+ "Authorization: Bearer SECRET_KEY",
76+ "Cache-Control: no-cache",
77+ ));
78+
79+ //So that curl_exec returns the contents of the cURL; rather than echoing it
80+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
81+
82+ //execute post
83+ $result = curl_exec($ch);
84+ echo $result;`
85+
86+ const json = `{
87+ "status": true,
88+ "message": "Refund retried and has been queued for processing",
89+ "data": {
90+ "integration": 123456,
91+ "transaction": 3298598423,
92+ "dispute": null,
93+ "settlement": null,
94+ "id": 1234567,
95+ "domain": "live",
96+ "currency": "NGN",
97+ "amount": 20000,
98+ "status": "processing",
99+ "refunded_at": null,
100+ "expected_at": "2025-10-13T16:02:18.000Z",
101+ "channel": "isw_3ds",
102+ "refunded_by": "[email protected] ", 103+ "customer_note": "Refund for transaction T708775813895475",
104+ "merchant_note": "Refund for transaction T708775813895475 by [email protected] ", 105+ "deducted_amount": 20000,
106+ "fully_deducted": true,
107+ "bank_reference": null,
108+ "reason": "PROCESSING",
109+ "customer": null,
110+ "initiated_by": "[email protected] ", 111+ "reversed_at": null,
112+ "session_id": null
113+ }
114+ }`
115+
116+ export { sh , js , php , json }
0 commit comments