# create a payment
curl -X POST https://api.sovrn.ventures/v1/payments \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"amount": 99.99,
"currency": "USD",
"crypto": "BTC",
"order_id": "ord_8421",
"metadata": { "sku": "PEP-001" }
}'
# response
{
"payment_id": "pay_a1b2c3d4",
"checkout_url": "https://sovrn.ventures/c/a1b2c3d4",
"wallet_address": "bc1q8x4...",
"crypto_amount": 0.00105,
"expires_at": 1715352000,
"status": "pending"
}
import requests, hmac, hashlib
# create a payment
r = requests.post(
"https://api.sovrn.ventures/v1/payments",
headers={"X-API-Key": "sk_live_your_key"},
json={
"amount": 99.99,
"currency": "USD",
"crypto": "BTC",
"order_id": "ord_8421",
},
)
payment = r.json()
print(payment["checkout_url"])
# verify a webhook
def verify(body, sig, secret):
expected = hmac.new(
secret.encode(), body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, sig)
import crypto from "node:crypto";
// create a payment
const res = await fetch("https://api.sovrn.ventures/v1/payments", {
method: "POST",
headers: {
"X-API-Key": "sk_live_your_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: 99.99,
currency: "USD",
crypto: "BTC",
order_id: "ord_8421",
}),
});
const payment = await res.json();
// verify a webhook
function verify(body, sig, secret) {
const h = crypto.createHmac("sha256", secret);
return h.update(body).digest("hex") === sig;
}
// create a payment
$ch = curl_init("https://api.sovrn.ventures/v1/payments");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: sk_live_your_key",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"amount" => 99.99,
"currency" => "USD",
"crypto" => "BTC",
"order_id" => "ord_8421",
]),
]);
$payment = json_decode(curl_exec($ch), true);
// verify a webhook
function verify($body, $sig, $secret) {
return hash_equals(
hash_hmac("sha256", $body, $secret),
$sig
);
}