Initialize a Transaction
To make this request, send an authenticated request to the initiatetrans endpoint.
post
https://api.1app.online/v1/business/initiatetrans
Initialize a transaction
Take a look at how you might do this:
cURL
NodeJs
PHP - cURL
Python
1
curl --location --request POST 'https://api.1app.online/v1/business/initiatetrans' \
2
--header 'Authorization: Bearer YOUR_SECRET_KEY' \
3
--form 'reference="fghjkl56789g"' \
4
--form 'amount="500"' \
5
--form 'customer_email="[email protected]"' \
6
--form 'currency="NGN"' \
7
--form 'redirecturl="https://example.com"' \
8
--form 'fname="John"' \
9
--form 'lname="Doe"'
Copied!
1
var https = require('follow-redirects').https;
2
var fs = require('fs');
3
4
var options = {
5
'method': 'POST',
6
'hostname': 'api.1app.online',
7
'path': '/v1/business/initiatetrans',
8
'headers': {
9
'Authorization': 'Bearer YOUR_SECRET_KEY'
10
},
11
'maxRedirects': 20
12
};
13
14
var req = https.request(options, function (res) {
15
var chunks = [];
16
17
res.on("data", function (chunk) {
18
chunks.push(chunk);
19
});
20
21
res.on("end", function (chunk) {
22
var body = Buffer.concat(chunks);
23
console.log(body.toString());
24
});
25
26
res.on("error", function (error) {
27
console.error(error);
28
});
29
});
30
31
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"reference\"\r\n\r\nfghjkl56789g\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n500\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"customer_email\"\r\n\r\[email protected]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"currency\"\r\n\r\nNGN\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"redirecturl\"\r\n\r\nhttps://example.com\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"fname\"\r\n\r\nJohn\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"lname\"\r\n\r\nDoe\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
32
33
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
34
35
req.write(postData);
36
37
req.end();
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://api.1app.online/v1/business/initiatetrans',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS => array('reference' => 'fghjkl56789g','amount' => '500','customer_email' => '[email protected]','currency' => 'NGN','redirecturl' => 'https://example.com','fname' => 'John','lname' => 'Doe'),
15
CURLOPT_HTTPHEADER => array(
16
'Authorization: Bearer YOUR_SECRET_KEY'
17
),
18
));
19
20
$response = curl_exec($curl);
21
22
curl_close($curl);
23
echo $response;
24
Copied!
1
import requests
2
3
url = "https://api.1app.online/v1/business/initiatetrans"
4
5
payload={'reference': 'fghjkl56789g',
6
'amount': '500',
7
'customer_email': '[email protected]',
8
'currency': 'NGN',
9
'redirecturl': 'https://example.com',
10
'fname': 'John',
11
'lname': 'Doe'}
12
files=[
13
14
]
15
headers = {
16
'Authorization': 'Bearer YOUR_SECRET_KEY'
17
}
18
19
response = requests.request("POST", url, headers=headers, data=payload, files=files)
20
21
print(response.text)
22
Copied!

Sample response

1
{
2
"status": true,
3
"message": "Successful",
4
"reference": "2345KDF12",
5
"access_token": "6983b68c269f7fgha2beb85625288",
6
"authorization_url": "https://1app.online/checkout/6983b68c269f7fgha2beb85625288/63490b1643375660547"
7
}
Copied!