Transaction Cost
Introduction
The "Transaction Cost" feature allows users to retrieve the cost of a transaction by making an HTTP GET request to our API. This documentation provides details on how to retrieve transaction cost and includes code examples in various programming languages.
Retrieving Transaction Cost
To retrieve transaction cost, users need to make an HTTP GET request to the specified endpoint with the required parameters.
Endpoint
https://api.mypayd.app/api/v1/transaction-costs?amount=100&type=withdrawal&channel=mobile
Authorization
Users need to include basic authentication credentials in the request headers.
Params
amount 100
type withdrawal or bank
channel mobile
Code Examples
Below are code examples in different programming languages demonstrating how to retrieve transaction cost using an HTTP GET request.
- Curl
- Go
- Nodejs
- Python
- PHP
curl --location 'https://api.mypayd.app/api/v1/transaction-costs?amount=100&type=withdrawal&channel=mobile' \
--data ''
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mypayd.app/api/v1/transaction-costs?amount=100&type=withdrawal&channel=mobile"
method := "GET"
payload := strings.NewReader(``)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var axios = require('axios');
var data = '';
var config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.mypayd.app/api/v1/transaction-costs?amount=100&type=withdrawal&channel=mobile',
headers: { },
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests
url = "https://api.mypayd.app/api/v1/transaction-costs?amount=100&type=withdrawal&channel=mobile"
payload = ""
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.mypayd.app/api/v1/transaction-costs?amount=100&type=withdrawal&channel=mobile');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setBody('');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Conclusion
The "Transaction Cost" feature provides a convenient way for users to calculate the cost of a transaction before initiating it. By following the instructions outlined in this documentation, users can easily integrate transaction cost retrieval into their applications or services.