Create a payment
curl --request POST \
--url https://api.usecobalt.com/v1/payments \
--header 'Content-Type: application/json' \
--header 'access_token: <api-key>' \
--header 'client_id: <api-key>' \
--header 'client_secret: <api-key>' \
--data '
{
"patient_mrn": "12345",
"payment_method": "Card",
"reference_number": "#123456",
"location": "1404",
"amount": 350,
"notes": "Copay collected at the front desk.",
"deposit_date": "2026-06-15",
"callback_urls": [
"https://example.com/webhooks/cobalt"
]
}
'import requests
url = "https://api.usecobalt.com/v1/payments"
payload = {
"patient_mrn": "12345",
"payment_method": "Card",
"reference_number": "#123456",
"location": "1404",
"amount": 350,
"notes": "Copay collected at the front desk.",
"deposit_date": "2026-06-15",
"callback_urls": ["https://example.com/webhooks/cobalt"]
}
headers = {
"client_id": "<api-key>",
"client_secret": "<api-key>",
"access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
client_id: '<api-key>',
client_secret: '<api-key>',
access_token: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
patient_mrn: '12345',
payment_method: 'Card',
reference_number: '#123456',
location: '1404',
amount: 350,
notes: 'Copay collected at the front desk.',
deposit_date: '2026-06-15',
callback_urls: ['https://example.com/webhooks/cobalt']
})
};
fetch('https://api.usecobalt.com/v1/payments', 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.usecobalt.com/v1/payments",
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([
'patient_mrn' => '12345',
'payment_method' => 'Card',
'reference_number' => '#123456',
'location' => '1404',
'amount' => 350,
'notes' => 'Copay collected at the front desk.',
'deposit_date' => '2026-06-15',
'callback_urls' => [
'https://example.com/webhooks/cobalt'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access_token: <api-key>",
"client_id: <api-key>",
"client_secret: <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.usecobalt.com/v1/payments"
payload := strings.NewReader("{\n \"patient_mrn\": \"12345\",\n \"payment_method\": \"Card\",\n \"reference_number\": \"#123456\",\n \"location\": \"1404\",\n \"amount\": 350,\n \"notes\": \"Copay collected at the front desk.\",\n \"deposit_date\": \"2026-06-15\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client_id", "<api-key>")
req.Header.Add("client_secret", "<api-key>")
req.Header.Add("access_token", "<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.usecobalt.com/v1/payments")
.header("client_id", "<api-key>")
.header("client_secret", "<api-key>")
.header("access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patient_mrn\": \"12345\",\n \"payment_method\": \"Card\",\n \"reference_number\": \"#123456\",\n \"location\": \"1404\",\n \"amount\": 350,\n \"notes\": \"Copay collected at the front desk.\",\n \"deposit_date\": \"2026-06-15\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usecobalt.com/v1/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client_id"] = '<api-key>'
request["client_secret"] = '<api-key>'
request["access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patient_mrn\": \"12345\",\n \"payment_method\": \"Card\",\n \"reference_number\": \"#123456\",\n \"location\": \"1404\",\n \"amount\": 350,\n \"notes\": \"Copay collected at the front desk.\",\n \"deposit_date\": \"2026-06-15\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"payment_id": "<string>",
"job_id": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}Payments
Create Payment
Posts a patient payment back to the provider’s EMR ledger.
POST
/
payments
Create a payment
curl --request POST \
--url https://api.usecobalt.com/v1/payments \
--header 'Content-Type: application/json' \
--header 'access_token: <api-key>' \
--header 'client_id: <api-key>' \
--header 'client_secret: <api-key>' \
--data '
{
"patient_mrn": "12345",
"payment_method": "Card",
"reference_number": "#123456",
"location": "1404",
"amount": 350,
"notes": "Copay collected at the front desk.",
"deposit_date": "2026-06-15",
"callback_urls": [
"https://example.com/webhooks/cobalt"
]
}
'import requests
url = "https://api.usecobalt.com/v1/payments"
payload = {
"patient_mrn": "12345",
"payment_method": "Card",
"reference_number": "#123456",
"location": "1404",
"amount": 350,
"notes": "Copay collected at the front desk.",
"deposit_date": "2026-06-15",
"callback_urls": ["https://example.com/webhooks/cobalt"]
}
headers = {
"client_id": "<api-key>",
"client_secret": "<api-key>",
"access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
client_id: '<api-key>',
client_secret: '<api-key>',
access_token: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
patient_mrn: '12345',
payment_method: 'Card',
reference_number: '#123456',
location: '1404',
amount: 350,
notes: 'Copay collected at the front desk.',
deposit_date: '2026-06-15',
callback_urls: ['https://example.com/webhooks/cobalt']
})
};
fetch('https://api.usecobalt.com/v1/payments', 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.usecobalt.com/v1/payments",
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([
'patient_mrn' => '12345',
'payment_method' => 'Card',
'reference_number' => '#123456',
'location' => '1404',
'amount' => 350,
'notes' => 'Copay collected at the front desk.',
'deposit_date' => '2026-06-15',
'callback_urls' => [
'https://example.com/webhooks/cobalt'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access_token: <api-key>",
"client_id: <api-key>",
"client_secret: <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.usecobalt.com/v1/payments"
payload := strings.NewReader("{\n \"patient_mrn\": \"12345\",\n \"payment_method\": \"Card\",\n \"reference_number\": \"#123456\",\n \"location\": \"1404\",\n \"amount\": 350,\n \"notes\": \"Copay collected at the front desk.\",\n \"deposit_date\": \"2026-06-15\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client_id", "<api-key>")
req.Header.Add("client_secret", "<api-key>")
req.Header.Add("access_token", "<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.usecobalt.com/v1/payments")
.header("client_id", "<api-key>")
.header("client_secret", "<api-key>")
.header("access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patient_mrn\": \"12345\",\n \"payment_method\": \"Card\",\n \"reference_number\": \"#123456\",\n \"location\": \"1404\",\n \"amount\": 350,\n \"notes\": \"Copay collected at the front desk.\",\n \"deposit_date\": \"2026-06-15\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usecobalt.com/v1/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client_id"] = '<api-key>'
request["client_secret"] = '<api-key>'
request["access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patient_mrn\": \"12345\",\n \"payment_method\": \"Card\",\n \"reference_number\": \"#123456\",\n \"location\": \"1404\",\n \"amount\": 350,\n \"notes\": \"Copay collected at the front desk.\",\n \"deposit_date\": \"2026-06-15\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"payment_id": "<string>",
"job_id": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}Posting payments is an asynchronous operation. The endpoint validates your request, queues the payment, and returns immediately with a
payment_id and job_id. The payment is posted to the EMR by a background worker, and a webhook event is sent to your registered endpoint upon completion.Request Parameters
Required Fields
- patient_mrn (string, required): Medical Record Number (MRN) of the patient the payment belongs to.
- payment_method (string, required): Name of the payment method as configured in the EMR (e.g.
"Card"). The worker resolves this name to the EMR’s internal payment method id at post time. - reference_number (string, required): Your reference for the payment (e.g. a transaction or receipt number). Reference numbers may be reused across payments — they are not used as a uniqueness key.
- location (string, required): Identifier of the EMR location/facility the payment is posted against.
- amount (number, required): Payment amount. Must be a positive number.
Optional Fields
- notes (string, optional): Free-text note recorded with the payment in the EMR.
- deposit_date (string, optional): Deposit date in
YYYY-MM-DDformat. Defaults to today if omitted.
Example Request
curl -X POST https://api.usecobalt.com/v1/payments \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
"patient_mrn": "MRN-12345",
"payment_method": "Card",
"reference_number": "#123456",
"location": "1404",
"amount": 350,
"notes": "Patient copay collected at front desk",
"deposit_date": "2026-06-15"
}'
Example Response
{
"success": true,
"message": "Payment processing. A webhook event will be sent upon completion.",
"payment_id": "123e4567e89b12d3a456426614174001",
"job_id": 12345
}
- payment_id: Unique identifier for the created payment record.
- job_id: Job execution identifier for tracking the async operation.
Error Responses
Missing or Invalid Field
If a required field is missing or invalid, the API returns a400 with the specific field name:
{
"success": false,
"message": "Missing or invalid required field: amount (must be a positive number)"
}
Patient Not Found
If the patient MRN cannot be resolved to an EMR patient, the API returns a404:
{
"success": false,
"message": "Patient with MRN 'MRN-12345' not found. Please ensure the patient has been synced and has an EMR patient ID."
}
User Not Found
{
"success": false,
"message": "User not found."
}
Webhook Notifications
When the payment posting is complete, we will send a webhook to your registered endpoint. Here are examples of what those webhook payloads will look like:Success
{
"id": "evt_1J9X2q2eZvKYlo2CluR9g9gV",
"access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
"object": "event",
"created": "2026-06-15T10:30:00Z",
"type": "payment.created",
"job_id": "12345",
"data": {
"payment_id": "123e4567e89b12d3a456426614174001",
"emr_transaction_id": "13969262",
"payment_method": "Card",
"amount": 350,
"reference_number": "#123456",
"patient_mrn": "MRN-12345"
}
}
Failure
{
"id": "evt_1J9X2q2eZvKYlo2CluR9g9gW",
"access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
"object": "event",
"created": "2026-06-15T10:35:00Z",
"type": "payment.failed",
"job_id": "12345",
"data": {
"payment_id": "123e4567e89b12d3a456426614174001",
"failure_reason": "Failed to post payment"
}
}
Authorizations
Body
application/json
Medical Record Number of the patient the payment is for.
Example:
"12345"
Payment method (e.g. "Card", "Cash", "Check").
Example:
"Card"
Payment reference number. Reusable — the controller does not de-duplicate.
Example:
"#123456"
EMR location ID the payment is posted at.
Example:
"1404"
Payment amount. Must be a positive number.
Example:
350
Free-text notes for the payment.
Example:
"Copay collected at the front desk."
Deposit date (ISO 8601, YYYY-MM-DD). Defaults to today when omitted.
Example:
"2026-06-15"
URLs to receive the completion webhook for this payment, in addition to the account webhook.
Example:
["https://example.com/webhooks/cobalt"]