curl --request POST \
--url https://api.example.com/v1/payments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"session_id": "<string>",
"amount_cents": 1,
"student_id": "<string>",
"tutor_id": "<string>",
"currency": "aud",
"payment_type": "external",
"status": "succeeded"
}
'import requests
url = "https://api.example.com/v1/payments"
payload = {
"session_id": "<string>",
"amount_cents": 1,
"student_id": "<string>",
"tutor_id": "<string>",
"currency": "aud",
"payment_type": "external",
"status": "succeeded"
}
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({
session_id: '<string>',
amount_cents: 1,
student_id: '<string>',
tutor_id: '<string>',
currency: 'aud',
payment_type: 'external',
status: 'succeeded'
})
};
fetch('https://api.example.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.example.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([
'session_id' => '<string>',
'amount_cents' => 1,
'student_id' => '<string>',
'tutor_id' => '<string>',
'currency' => 'aud',
'payment_type' => 'external',
'status' => 'succeeded'
]),
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://api.example.com/v1/payments"
payload := strings.NewReader("{\n \"session_id\": \"<string>\",\n \"amount_cents\": 1,\n \"student_id\": \"<string>\",\n \"tutor_id\": \"<string>\",\n \"currency\": \"aud\",\n \"payment_type\": \"external\",\n \"status\": \"succeeded\"\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://api.example.com/v1/payments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"<string>\",\n \"amount_cents\": 1,\n \"student_id\": \"<string>\",\n \"tutor_id\": \"<string>\",\n \"currency\": \"aud\",\n \"payment_type\": \"external\",\n \"status\": \"succeeded\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/payments")
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 \"session_id\": \"<string>\",\n \"amount_cents\": 1,\n \"student_id\": \"<string>\",\n \"tutor_id\": \"<string>\",\n \"currency\": \"aud\",\n \"payment_type\": \"external\",\n \"status\": \"succeeded\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"session_id": "<string>",
"student_id": "<string>",
"tutor_id": "<string>",
"amount_cents": 123,
"refund_amount_cents": 123,
"currency": "<string>",
"payment_type": "<string>",
"status": "<string>",
"stripe_payment_intent_id": "<string>",
"created_at": "<string>"
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}Create Payment
Record a MANUAL / EXTERNAL payment (cash, bank transfer, off-platform).
This endpoint NEVER initiates a real charge. payment_type must be external
— any Stripe/processor value (single_session, group_session, package_redemption)
is rejected with 422, because a real charge must flow through the Stripe
PaymentIntent + webhook that keeps session_ledger consistent; the Python
backend does not own money flows.
organization_id and created_at are server-set; stripe_payment_intent_id
is always null. The referenced session_id (and any
student_id/tutor_id) must be org-scoped (404 otherwise). Honours
Idempotency-Key.
curl --request POST \
--url https://api.example.com/v1/payments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"session_id": "<string>",
"amount_cents": 1,
"student_id": "<string>",
"tutor_id": "<string>",
"currency": "aud",
"payment_type": "external",
"status": "succeeded"
}
'import requests
url = "https://api.example.com/v1/payments"
payload = {
"session_id": "<string>",
"amount_cents": 1,
"student_id": "<string>",
"tutor_id": "<string>",
"currency": "aud",
"payment_type": "external",
"status": "succeeded"
}
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({
session_id: '<string>',
amount_cents: 1,
student_id: '<string>',
tutor_id: '<string>',
currency: 'aud',
payment_type: 'external',
status: 'succeeded'
})
};
fetch('https://api.example.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.example.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([
'session_id' => '<string>',
'amount_cents' => 1,
'student_id' => '<string>',
'tutor_id' => '<string>',
'currency' => 'aud',
'payment_type' => 'external',
'status' => 'succeeded'
]),
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://api.example.com/v1/payments"
payload := strings.NewReader("{\n \"session_id\": \"<string>\",\n \"amount_cents\": 1,\n \"student_id\": \"<string>\",\n \"tutor_id\": \"<string>\",\n \"currency\": \"aud\",\n \"payment_type\": \"external\",\n \"status\": \"succeeded\"\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://api.example.com/v1/payments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"<string>\",\n \"amount_cents\": 1,\n \"student_id\": \"<string>\",\n \"tutor_id\": \"<string>\",\n \"currency\": \"aud\",\n \"payment_type\": \"external\",\n \"status\": \"succeeded\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/payments")
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 \"session_id\": \"<string>\",\n \"amount_cents\": 1,\n \"student_id\": \"<string>\",\n \"tutor_id\": \"<string>\",\n \"currency\": \"aud\",\n \"payment_type\": \"external\",\n \"status\": \"succeeded\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"session_id": "<string>",
"student_id": "<string>",
"tutor_id": "<string>",
"amount_cents": 123,
"refund_amount_cents": 123,
"currency": "<string>",
"payment_type": "<string>",
"status": "<string>",
"stripe_payment_intent_id": "<string>",
"created_at": "<string>"
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}Authorizations
Org API key as Token token=ei_live_...
Headers
Body
POST /v1/payments → session_payments. MANUAL / EXTERNAL payments ONLY.
payment_type is restricted to 'external' — this endpoint NEVER initiates a
real charge. Stripe/processor payment_types (single_session, group_session,
package_redemption) are rejected with 422 because the Python backend does not
own money flows: a real charge must go through the Stripe PaymentIntent +
webhook that drives session_ledger. The referenced session/student/tutor must
be org-scoped.
Cents. Must be >= 0.
x >= 0Only 'external' is accepted (manual/off-platform). Stripe types are rejected.
succeeded | pending | failed
Response
Successful Response
Was this page helpful?