Check for a saved card
curl --request GET \
--url https://api.ornn.com/commerce/billing/payment-method \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ornn.com/commerce/billing/payment-method"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ornn.com/commerce/billing/payment-method', 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.ornn.com/commerce/billing/payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ornn.com/commerce/billing/payment-method"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ornn.com/commerce/billing/payment-method")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ornn.com/commerce/billing/payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"saved": true,
"defaultPaymentMethodId": "pm_example",
"cards": [
{
"id": "pm_example",
"brand": "visa",
"last4": "4242",
"expMonth": 3,
"expYear": 2030
}
]
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}Check for a saved card
Reports whether your organization has a saved card that Ornn can charge after credits run out. It never returns full card numbers or security codes. The response includes safe display details for attached cards. Save or replace a card in the console.
GET
/
commerce
/
billing
/
payment-method
Check for a saved card
curl --request GET \
--url https://api.ornn.com/commerce/billing/payment-method \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ornn.com/commerce/billing/payment-method"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ornn.com/commerce/billing/payment-method', 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.ornn.com/commerce/billing/payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ornn.com/commerce/billing/payment-method"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ornn.com/commerce/billing/payment-method")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ornn.com/commerce/billing/payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"saved": true,
"defaultPaymentMethodId": "pm_example",
"cards": [
{
"id": "pm_example",
"brand": "visa",
"last4": "4242",
"expMonth": 3,
"expYear": 2030
}
]
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}Saving or replacing a card uses the console’s secure card form; there is no API for it.
The response contains
saved, defaultPaymentMethodId, and cards. Each card includes only its ID, brand, last four digits, and expiration month and year. Only cards attached to your organization are returned.Authorizations
Create an organization API key in Account Settings > Developer. Do not send this key to the Kubernetes API server.
Query Parameters
Return 409 payment_method_required if no attached default card is saved. Omit to read status without requiring a card.
Available options:
true Was this page helpful?