Create a hosted top-up checkout session
curl --request POST \
--url https://api.monid.ai/v1/wallet/topup/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 25,
"currency": "USD",
"success_redirect": "https://app.monid.ai/wallet?topup=success",
"cancel_redirect": "https://app.monid.ai/wallet?topup=cancelled",
"autoReload": true
}
'import requests
url = "https://api.monid.ai/v1/wallet/topup/sessions"
payload = {
"amount": 25,
"currency": "USD",
"success_redirect": "https://app.monid.ai/wallet?topup=success",
"cancel_redirect": "https://app.monid.ai/wallet?topup=cancelled",
"autoReload": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 25,
currency: 'USD',
success_redirect: 'https://app.monid.ai/wallet?topup=success',
cancel_redirect: 'https://app.monid.ai/wallet?topup=cancelled',
autoReload: true
})
};
fetch('https://api.monid.ai/v1/wallet/topup/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.monid.ai/v1/wallet/topup/sessions",
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' => 25,
'currency' => 'USD',
'success_redirect' => 'https://app.monid.ai/wallet?topup=success',
'cancel_redirect' => 'https://app.monid.ai/wallet?topup=cancelled',
'autoReload' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: 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"
"net/http"
"io"
)
func main() {
url := "https://api.monid.ai/v1/wallet/topup/sessions"
payload := strings.NewReader("{\n \"amount\": 25,\n \"currency\": \"USD\",\n \"success_redirect\": \"https://app.monid.ai/wallet?topup=success\",\n \"cancel_redirect\": \"https://app.monid.ai/wallet?topup=cancelled\",\n \"autoReload\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.monid.ai/v1/wallet/topup/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 25,\n \"currency\": \"USD\",\n \"success_redirect\": \"https://app.monid.ai/wallet?topup=success\",\n \"cancel_redirect\": \"https://app.monid.ai/wallet?topup=cancelled\",\n \"autoReload\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.monid.ai/v1/wallet/topup/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 25,\n \"currency\": \"USD\",\n \"success_redirect\": \"https://app.monid.ai/wallet?topup=success\",\n \"cancel_redirect\": \"https://app.monid.ai/wallet?topup=cancelled\",\n \"autoReload\": true\n}"
response = http.request(request)
puts response.read_body{
"paymentProcessor": "STRIPE",
"sessionId": "cs_test_...",
"url": "https://checkout.stripe.com/c/pay/..."
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {},
"walletStatus": "PROVISIONING"
}Wallet
Create a hosted top-up checkout session
Creates a Stripe checkout page for adding money to the wallet and returns its url. Send the amount to add. Use it when a run fails with WALLET_INSUFFICIENT_FUNDS (402). An agent cannot pay by itself, so it gives the url to its human owner.
POST
/
v1
/
wallet
/
topup
/
sessions
Create a hosted top-up checkout session
curl --request POST \
--url https://api.monid.ai/v1/wallet/topup/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 25,
"currency": "USD",
"success_redirect": "https://app.monid.ai/wallet?topup=success",
"cancel_redirect": "https://app.monid.ai/wallet?topup=cancelled",
"autoReload": true
}
'import requests
url = "https://api.monid.ai/v1/wallet/topup/sessions"
payload = {
"amount": 25,
"currency": "USD",
"success_redirect": "https://app.monid.ai/wallet?topup=success",
"cancel_redirect": "https://app.monid.ai/wallet?topup=cancelled",
"autoReload": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 25,
currency: 'USD',
success_redirect: 'https://app.monid.ai/wallet?topup=success',
cancel_redirect: 'https://app.monid.ai/wallet?topup=cancelled',
autoReload: true
})
};
fetch('https://api.monid.ai/v1/wallet/topup/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.monid.ai/v1/wallet/topup/sessions",
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' => 25,
'currency' => 'USD',
'success_redirect' => 'https://app.monid.ai/wallet?topup=success',
'cancel_redirect' => 'https://app.monid.ai/wallet?topup=cancelled',
'autoReload' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: 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"
"net/http"
"io"
)
func main() {
url := "https://api.monid.ai/v1/wallet/topup/sessions"
payload := strings.NewReader("{\n \"amount\": 25,\n \"currency\": \"USD\",\n \"success_redirect\": \"https://app.monid.ai/wallet?topup=success\",\n \"cancel_redirect\": \"https://app.monid.ai/wallet?topup=cancelled\",\n \"autoReload\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.monid.ai/v1/wallet/topup/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 25,\n \"currency\": \"USD\",\n \"success_redirect\": \"https://app.monid.ai/wallet?topup=success\",\n \"cancel_redirect\": \"https://app.monid.ai/wallet?topup=cancelled\",\n \"autoReload\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.monid.ai/v1/wallet/topup/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 25,\n \"currency\": \"USD\",\n \"success_redirect\": \"https://app.monid.ai/wallet?topup=success\",\n \"cancel_redirect\": \"https://app.monid.ai/wallet?topup=cancelled\",\n \"autoReload\": true\n}"
response = http.request(request)
puts response.read_body{
"paymentProcessor": "STRIPE",
"sessionId": "cs_test_...",
"url": "https://checkout.stripe.com/c/pay/..."
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {}
}{
"code": 400,
"message": "Bad Request",
"errorCode": "BAD_REQUEST",
"hints": {},
"walletStatus": "PROVISIONING"
}Body
application/json
Where to send the payer after a successful checkout. Must be on the Monid web-app origin. Defaults to the web-app wallet page, so an agent without a UI can omit it and hand the returned url to its owner. Monid appends a session_id query parameter (the checkout session id).
Example:
"https://app.monid.ai/wallet?topup=success"