curl
curl -X POST 'https://verification.didit.me/v3/billing/top-up/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"amount_in_dollars": 500,
"success_url": "https://yourapp.com/billing/success",
"cancel_url": "https://yourapp.com/billing/cancel"
}'import os
import requests
resp = requests.post(
'https://verification.didit.me/v3/billing/top-up/',
headers={
'x-api-key': os.environ['DIDIT_API_KEY'],
'Content-Type': 'application/json',
},
json={
'amount_in_dollars': 500,
'success_url': 'https://yourapp.com/billing/success',
'cancel_url': 'https://yourapp.com/billing/cancel',
},
timeout=10,
)
resp.raise_for_status()
session = resp.json()
print('Redirect customer to:', session['checkout_session_url'])const resp = await fetch('https://verification.didit.me/v3/billing/top-up/', {
method: 'POST',
headers: {
'x-api-key': process.env.DIDIT_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount_in_dollars: 500,
success_url: 'https://yourapp.com/billing/success',
cancel_url: 'https://yourapp.com/billing/cancel',
}),
});
if (!resp.ok) throw new Error(`Top-up failed: ${resp.status}`);
const { checkout_session_url } = await resp.json();
window.location.assign(checkout_session_url);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://verification.didit.me/v3/billing/top-up/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_in_dollars' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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"
"net/http"
"io"
)
func main() {
url := "https://verification.didit.me/v3/billing/top-up/"
payload := strings.NewReader("{\n \"amount_in_dollars\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://verification.didit.me/v3/billing/top-up/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_dollars\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://verification.didit.me/v3/billing/top-up/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in_dollars\": 50\n}"
response = http.request(request)
puts response.read_body{
"checkout_session_id": "cs_test_a1B2c3D4e5F6g7H8i9J0",
"checkout_session_url": "https://checkout.stripe.com/c/pay/cs_test_a1B2c3D4e5F6g7H8i9J0"
}Billing
Top Up Credits
Add credits via a hosted Stripe Checkout session ($50 minimum); not available on annual plans. Redirect the customer to the returned checkout_session_url.
POST
/
v3
/
billing
/
top-up
/
curl
curl -X POST 'https://verification.didit.me/v3/billing/top-up/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"amount_in_dollars": 500,
"success_url": "https://yourapp.com/billing/success",
"cancel_url": "https://yourapp.com/billing/cancel"
}'import os
import requests
resp = requests.post(
'https://verification.didit.me/v3/billing/top-up/',
headers={
'x-api-key': os.environ['DIDIT_API_KEY'],
'Content-Type': 'application/json',
},
json={
'amount_in_dollars': 500,
'success_url': 'https://yourapp.com/billing/success',
'cancel_url': 'https://yourapp.com/billing/cancel',
},
timeout=10,
)
resp.raise_for_status()
session = resp.json()
print('Redirect customer to:', session['checkout_session_url'])const resp = await fetch('https://verification.didit.me/v3/billing/top-up/', {
method: 'POST',
headers: {
'x-api-key': process.env.DIDIT_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount_in_dollars: 500,
success_url: 'https://yourapp.com/billing/success',
cancel_url: 'https://yourapp.com/billing/cancel',
}),
});
if (!resp.ok) throw new Error(`Top-up failed: ${resp.status}`);
const { checkout_session_url } = await resp.json();
window.location.assign(checkout_session_url);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://verification.didit.me/v3/billing/top-up/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_in_dollars' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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"
"net/http"
"io"
)
func main() {
url := "https://verification.didit.me/v3/billing/top-up/"
payload := strings.NewReader("{\n \"amount_in_dollars\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://verification.didit.me/v3/billing/top-up/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_dollars\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://verification.didit.me/v3/billing/top-up/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in_dollars\": 50\n}"
response = http.request(request)
puts response.read_body{
"checkout_session_id": "cs_test_a1B2c3D4e5F6g7H8i9J0",
"checkout_session_url": "https://checkout.stripe.com/c/pay/cs_test_a1B2c3D4e5F6g7H8i9J0"
}Authorizations
Body
application/json
Amount to charge, in USD. Must be at least 50. Tax is added automatically at checkout based on the customer's billing address.
Required range:
x >= 50URL Stripe redirects the customer to after a successful payment. Defaults to https://console.didit.me. Append the literal placeholder {CHECKOUT_SESSION_ID} if you want Stripe to substitute the session ID.
URL Stripe redirects the customer to when they abort or close the Checkout window. Defaults to https://console.didit.me.
Response
Stripe Checkout session created. Redirect the user to checkout_session_url to complete payment.