Skip to content

Commit e382eac

Browse files
committed
add code snippets for vt remove-split-code endpoint
1 parent 603fa54 commit e382eac

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
languages:
2+
- sh
3+
- js
4+
- php
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const https = require('https')
2+
3+
const params = JSON.stringify({
4+
"split_code": "SPL_98WF13Zu8w5"
5+
})
6+
7+
const options = {
8+
hostname: 'api.paystack.co',
9+
port: 443,
10+
path: '/virtual_terminal/:code/split_code',
11+
method: 'DELETE',
12+
headers: {
13+
Authorization: 'Bearer SECRET_KEY',
14+
'Content-Type': 'application/json',
15+
}
16+
}
17+
18+
const req = https.request(options, res => {
19+
let data = ''
20+
21+
res.on('data', (chunk) => {
22+
data += chunk
23+
})
24+
25+
res.on('end', () => {
26+
console.log(JSON.parse(data))
27+
})
28+
})
29+
30+
req.on('error', error => {
31+
console.error(error)
32+
})
33+
34+
req.write(params)
35+
req.end()
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
$curl = curl_init();
3+
4+
$data = array(
5+
"split_code" => "SPL_98WF13Zu8w5"
6+
);
7+
8+
curl_setopt_array($curl, array(
9+
CURLOPT_URL => "https://api.paystack.co/virtual_terminal/:code/split",
10+
CURLOPT_RETURNTRANSFER => true,
11+
CURLOPT_CUSTOMREQUEST => "DELETE",
12+
CURLOPT_POSTFIELDS => json_encode($data),
13+
CURLOPT_HTTPHEADER => array(
14+
"Authorization: Bearer SECRET_KEY",
15+
"Content-Type: application/json",
16+
"Cache-Control: no-cache"
17+
),
18+
));
19+
20+
$response = curl_exec($curl);
21+
$err = curl_error($curl);
22+
curl_close($curl);
23+
24+
if ($err) {
25+
echo "cURL Error #:" . $err;
26+
} else {
27+
echo $response;
28+
}
29+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
url="https://api.paystack.co/virtual_terminal/:code/split_code"
3+
authorization="Authorization: Bearer SECRET_KEY"
4+
content_type="Content-Type: application/json"
5+
data='{
6+
"split_code": "SPL_98WF13Zu8w5"
7+
}'
8+
9+
curl "$url" -H "$authorization" -H "$content_type" -X DELETE -d "$data"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"400": {
3+
"status": false,
4+
"message": "Payment method does not exist",
5+
"meta": {
6+
"nextStep": "Ensure that you're passing the correct reference for the requested resource that exists on this integration"
7+
},
8+
"type": "validation_error",
9+
"code": "not_found"
10+
}
11+
}

0 commit comments

Comments
 (0)