Setup drawdown billing
curl --request POST \
--url https://staging.api.rye.com/api/v1/billing/drawdown \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"minBalanceSubunits": 200000,
"targetBalanceSubunits": 1000000,
"chargeAutomatically": true
}
'import requests
url = "https://staging.api.rye.com/api/v1/billing/drawdown"
payload = {
"minBalanceSubunits": 200000,
"targetBalanceSubunits": 1000000,
"chargeAutomatically": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
minBalanceSubunits: 200000,
targetBalanceSubunits: 1000000,
chargeAutomatically: true
})
};
fetch('https://staging.api.rye.com/api/v1/billing/drawdown', 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://staging.api.rye.com/api/v1/billing/drawdown",
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([
'minBalanceSubunits' => 200000,
'targetBalanceSubunits' => 1000000,
'chargeAutomatically' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://staging.api.rye.com/api/v1/billing/drawdown"
payload := strings.NewReader("{\n \"minBalanceSubunits\": 200000,\n \"targetBalanceSubunits\": 1000000,\n \"chargeAutomatically\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://staging.api.rye.com/api/v1/billing/drawdown")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"minBalanceSubunits\": 200000,\n \"targetBalanceSubunits\": 1000000,\n \"chargeAutomatically\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.rye.com/api/v1/billing/drawdown")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"minBalanceSubunits\": 200000,\n \"targetBalanceSubunits\": 1000000,\n \"chargeAutomatically\": true\n}"
response = http.request(request)
puts response.read_body{
"drawdown": {
"balance": {
"currencyCode": "USD",
"amountSubunits": 1500
},
"config": {
"chargeAutomatically": true,
"currency": "USD",
"minBalanceSubunits": 200000,
"targetBalanceSubunits": 1000000
},
"enabled": true
}
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}Billing
Setup drawdown billing
Set up or update drawdown billing for the authenticated developer
POST
/
api
/
v1
/
billing
/
drawdown
Setup drawdown billing
curl --request POST \
--url https://staging.api.rye.com/api/v1/billing/drawdown \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"minBalanceSubunits": 200000,
"targetBalanceSubunits": 1000000,
"chargeAutomatically": true
}
'import requests
url = "https://staging.api.rye.com/api/v1/billing/drawdown"
payload = {
"minBalanceSubunits": 200000,
"targetBalanceSubunits": 1000000,
"chargeAutomatically": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
minBalanceSubunits: 200000,
targetBalanceSubunits: 1000000,
chargeAutomatically: true
})
};
fetch('https://staging.api.rye.com/api/v1/billing/drawdown', 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://staging.api.rye.com/api/v1/billing/drawdown",
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([
'minBalanceSubunits' => 200000,
'targetBalanceSubunits' => 1000000,
'chargeAutomatically' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://staging.api.rye.com/api/v1/billing/drawdown"
payload := strings.NewReader("{\n \"minBalanceSubunits\": 200000,\n \"targetBalanceSubunits\": 1000000,\n \"chargeAutomatically\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://staging.api.rye.com/api/v1/billing/drawdown")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"minBalanceSubunits\": 200000,\n \"targetBalanceSubunits\": 1000000,\n \"chargeAutomatically\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.rye.com/api/v1/billing/drawdown")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"minBalanceSubunits\": 200000,\n \"targetBalanceSubunits\": 1000000,\n \"chargeAutomatically\": true\n}"
response = http.request(request)
puts response.read_body{
"drawdown": {
"balance": {
"currencyCode": "USD",
"amountSubunits": 1500
},
"config": {
"chargeAutomatically": true,
"currency": "USD",
"minBalanceSubunits": 200000,
"targetBalanceSubunits": 1000000
},
"enabled": true
}
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}Authorizations
Rye API key
Body
application/json
Drawdown settings to configure
Minimum balance threshold in smallest currency unit (e.g. cents). A top-up is triggered when balance falls below this value.
Required range:
x >= 10Example:
200000
Target balance in smallest currency unit (e.g. cents). When balance drops below minBalanceSubunits, a top-up invoice is created to replenish to this amount.
Required range:
x >= 100Example:
1000000
Whether to automatically charge the invoice when created. Defaults to true if not specified.
Example:
true
Response
Updated billing configuration
Show child attributes
Show child attributes
Was this page helpful?
⌘I

