Create a budget link
curl --request POST \
--url https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"expiresInMinutes": 1440,
"returnUrl": "<string>"
}
'import requests
url = "https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links"
payload = {
"expiresInMinutes": 1440,
"returnUrl": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({expiresInMinutes: 1440, returnUrl: '<string>'})
};
fetch('https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links', 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.sapiom.ai/v1/payment-cards/{cardId}/budget-links",
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([
'expiresInMinutes' => 1440,
'returnUrl' => '<string>'
]),
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://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links"
payload := strings.NewReader("{\n \"expiresInMinutes\": 1440,\n \"returnUrl\": \"<string>\"\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://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expiresInMinutes\": 1440,\n \"returnUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links")
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 \"expiresInMinutes\": 1440,\n \"returnUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCards
Create a budget link
Creates a link where the user sets a new budget for the card. Send the user url. Sapiom returns it only in this response. The current budget stays in effect until the user confirms the new budget. Requires a user key with org.payment_budget_links.create.
POST
/
v1
/
payment-cards
/
{cardId}
/
budget-links
Create a budget link
curl --request POST \
--url https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"expiresInMinutes": 1440,
"returnUrl": "<string>"
}
'import requests
url = "https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links"
payload = {
"expiresInMinutes": 1440,
"returnUrl": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({expiresInMinutes: 1440, returnUrl: '<string>'})
};
fetch('https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links', 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.sapiom.ai/v1/payment-cards/{cardId}/budget-links",
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([
'expiresInMinutes' => 1440,
'returnUrl' => '<string>'
]),
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://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links"
payload := strings.NewReader("{\n \"expiresInMinutes\": 1440,\n \"returnUrl\": \"<string>\"\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://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expiresInMinutes\": 1440,\n \"returnUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sapiom.ai/v1/payment-cards/{cardId}/budget-links")
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 \"expiresInMinutes\": 1440,\n \"returnUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
application/json
Where the page sends the user when they finish, with budget_link and budget (verified, card_number, failed or skipped) added to the query. Use an https URL. For a local test, http works with localhost, 127.0.0.1 or [::1], for example http://localhost:3000/done. Do not put a user name or password in the URL.
Maximum string length:
2048Response
The link. url holds a one-time code and is only returned here