var https = require('https');
var options = {
'method': 'POST',
'hostname': 'ie.payout.one',
'path': '/api/v1/authorize',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "{\n\t\"client_id\": "88a6b2e4-c485-4250--b9b8ad92d41e",\n\t\"client_secret\": "4c4f4df3-d026--8c4b-98e0434c882a"\n}";
req.write(postData);
req.end();
require "uri"
require "net/http"
url = URI("https://ie.payout.one/api/v1/checkouts")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer SFMyNTY.g3QABBACZAEEZGF0YWEDZAAGc2lnbmVkbgYAe68kd2QB.72N3LRK5QXAvJteVRhzWsAsxipwplEsec06Gtg0uSw4
"
request["Accept"] = "application/json"
request.body = "{
"amount": 683,
"currency": "EUR",
"email": "john.doe@payout.one",
"customer": {
"first_name": "John",
"last_name": "Doe",
"note": "Good customer"
},
"external_id": "844c65d5-55a1-6530-f54e-02ddc9ce7b18",
"metadata": {
"note": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been."
},
"nonce": "a35fc329-6dc6-58ad-d40f-55bd981124b9",
"redirect_url": "https://payout.one/payment/redirect",
"signature": "0e82c6862a98ae7a0d1cd0b958c27b116e8c136bae899d43e8d115610c107bd3"
}"
response = http.request(request)
puts response.read_body
"https://ie.payout.one/api/v1/authorize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n\t\"client_id\": "88a6b2e4-c485-4250--b9b8ad92d41e",\n\t\"client_secret\": "4c4f4df3-d026--8c4b-98e0434c882a"\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Accept: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
package main
import (
"fmt"
"strings"
"os"
"path/filepath"
"net/http"
"io/ioutil"
)
func main() {
url := "https://ie.payout.one/api/v1/checkouts"
method := "POST"
payload := strings.NewReader("{\n \"amount\": 683,\n \"currency\": \"EUR\",\n \"customer\": {\n \"email\": \"john.doe@payout.one\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"note\": \"Good customer\"\n },\n \"external_id\": \"844c65d5-55a1-6530-f54e-02ddc9ce7b18\",\n \"metadata\": {\n \"note\": \"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been.\"\n },\n \"nonce\": \"a35fc329-6dc6-58ad-d40f-55bd981124b9\",\n \"redirect_url\": \"https://payout.one/payment/redirect\",\n \"signature\": \"0e82c6862a98ae7a0d1cd0b958c27b116e8c136bae899d43e8d115610c107bd3\"\n}")
client := &http.Client {
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer SFMyNTY.g3QABBACZAEEZGF0YWEDZAAGc2lnbmVkbgYAe68kd2QB.72N3LRK5QXAvJteVRhzWsAsxipwplEsec06Gtg0uSw4
")
req.Header.Add("Accept", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
...