curl -X POST https://doronpay.com/api/hub/credit \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-d '{
"externalTransactionId": "123434675",
"account_name": "John Doe",
"amount": "0.1",
"account_number": "0207573792",
"account_issuer": "vodafone",
"description": "doronpay test",
"callbackUrl": "https://webhook.site/36b4ec20-8ead-4b30-8b01-98c91697c5ed"
}'
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."; // From token endpoint
fetch('https://doronpay.com/api/hub/credit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
externalTransactionId: "123434675",
account_name: "John Doe",
amount: "0.1",
account_number: "0207573792",
account_issuer: "vodafone",
description: "doronpay test",
callbackUrl: "https://webhook.site/36b4ec20-8ead-4b30-8b01-98c91697c5ed"
})
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
// Store the transactionId for status checks
const transactionId = data.transactionId;
})
.catch((error) => {
console.error('Error:', error);
});
import requests
url = "https://doronpay.com/api/hub/credit"
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # From token endpoint
payload = {
"externalTransactionId": "123434675",
"account_name": "John Doe",
"amount": "0.1",
"account_number": "0207573792",
"account_issuer": "vodafone",
"description": "doronpay test",
"callbackUrl": "https://webhook.site/36b4ec20-8ead-4b30-8b01-98c91697c5ed"
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
if data["success"]:
# Store the transactionId for status checks
transaction_id = data["transactionId"]
print(f"Transaction ID: {transaction_id}")
else:
print(f"Error: {data['message']}")
<?php
$url = "https://doronpay.com/api/hub/credit";
$token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."; // From token endpoint
$payload = array(
"externalTransactionId" => "123434675",
"account_name" => "John Doe",
"amount" => "0.1",
"account_number" => "0207573792",
"account_issuer" => "vodafone",
"description" => "doronpay test",
"callbackUrl" => "https://webhook.site/36b4ec20-8ead-4b30-8b01-98c91697c5ed"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $token
));
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data["success"]) {
// Store the transactionId for status checks
$transactionId = $data["transactionId"];
echo "Transaction ID: " . $transactionId;
} else {
echo "Error: " . $data["message"];
}
?>