<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://pay.drutopay.com/api/payment/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(array(
"cus_name" => "John Doe",
"cus_email" => "[email protected]",
"success_url" => "https://yourdomain.com/success",
"cancel_url" => "https://yourdomain.com/cancel",
"webhook_url" => "https://yourdomain.com/webhook",
"amount" => "10",
"metadata" => array("order_id" => "1024")
)),
CURLOPT_HTTPHEADER => array(
'API-KEY: YOUR_BRAND_KEY',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$client = new Client();
$headers = [
'API-KEY' => 'YOUR_BRAND_KEY',
'Content-Type' => 'application/json'
];
$body = json_encode([
'cus_name' => 'John Doe',
'cus_email' => '[email protected]',
'success_url' => 'https://yourdomain.com/success',
'cancel_url' => 'https://yourdomain.com/cancel',
'webhook_url' => 'https://yourdomain.com/webhook',
'amount' => '10',
'metadata' => ['order_id' => '1024']
]);
$request = new Request('POST', 'https://pay.drutopay.com/api/payment/create', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
const axios = require('axios');
const data = JSON.stringify({
cus_name: "John Doe",
cus_email: "[email protected]",
success_url: "https://yourdomain.com/success",
cancel_url: "https://yourdomain.com/cancel",
webhook_url: "https://yourdomain.com/webhook",
amount: "10",
metadata: { order_id: "1024" }
});
const config = {
method: 'post',
url: 'https://pay.drutopay.com/api/payment/create',
headers: {
'API-KEY': 'YOUR_BRAND_KEY',
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
import requests
import json
url = "https://pay.drutopay.com/api/payment/create"
payload = json.dumps({
"cus_name": "John Doe",
"cus_email": "[email protected]",
"success_url": "https://yourdomain.com/success",
"cancel_url": "https://yourdomain.com/cancel",
"webhook_url": "https://yourdomain.com/webhook",
"amount": "10",
"metadata": {"order_id": "1024"}
})
headers = {
'API-KEY': 'YOUR_BRAND_KEY',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pay.drutopay.com/api/payment/create"
payload := strings.NewReader(`{"cus_name":"John Doe","cus_email":"[email protected]","success_url":"https://yourdomain.com/success","cancel_url":"https://yourdomain.com/cancel","webhook_url":"https://yourdomain.com/webhook","amount":"10","metadata":{"order_id":"1024"}}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-KEY", "YOUR_BRAND_KEY")
req.Header.Add("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}