Report Status
curl --request POST \
--url https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"txn_ref_id": "<string>",
"txn_type": "PURCHASE",
"authorization_code": "<string>",
"response_code": "<string>",
"amount_paid": "<string>",
"product_statuses": [
{
"product_id": "<string>",
"product_ref_id": "<string>",
"amount_paid": "<string>"
}
]
}
'import requests
url = "https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status"
payload = {
"txn_ref_id": "<string>",
"txn_type": "PURCHASE",
"authorization_code": "<string>",
"response_code": "<string>",
"amount_paid": "<string>",
"product_statuses": [
{
"product_id": "<string>",
"product_ref_id": "<string>",
"amount_paid": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
txn_ref_id: '<string>',
txn_type: 'PURCHASE',
authorization_code: '<string>',
response_code: '<string>',
amount_paid: '<string>',
product_statuses: [{product_id: '<string>', product_ref_id: '<string>', amount_paid: '<string>'}]
})
};
fetch('https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status', 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://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status",
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([
'txn_ref_id' => '<string>',
'txn_type' => 'PURCHASE',
'authorization_code' => '<string>',
'response_code' => '<string>',
'amount_paid' => '<string>',
'product_statuses' => [
[
'product_id' => '<string>',
'product_ref_id' => '<string>',
'amount_paid' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status"
payload := strings.NewReader("{\n \"txn_ref_id\": \"<string>\",\n \"txn_type\": \"PURCHASE\",\n \"authorization_code\": \"<string>\",\n \"response_code\": \"<string>\",\n \"amount_paid\": \"<string>\",\n \"product_statuses\": [\n {\n \"product_id\": \"<string>\",\n \"product_ref_id\": \"<string>\",\n \"amount_paid\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"txn_ref_id\": \"<string>\",\n \"txn_type\": \"PURCHASE\",\n \"authorization_code\": \"<string>\",\n \"response_code\": \"<string>\",\n \"amount_paid\": \"<string>\",\n \"product_statuses\": [\n {\n \"product_id\": \"<string>\",\n \"product_ref_id\": \"<string>\",\n \"amount_paid\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"txn_ref_id\": \"<string>\",\n \"txn_type\": \"PURCHASE\",\n \"authorization_code\": \"<string>\",\n \"response_code\": \"<string>\",\n \"amount_paid\": \"<string>\",\n \"product_statuses\": [\n {\n \"product_id\": \"<string>\",\n \"product_ref_id\": \"<string>\",\n \"amount_paid\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"txn_ref_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Server-Side API
Report Status
Report payment execution outcome back to Prava
POST
/
v1
/
sessions
/
{sessionId}
/
report-status
Report Status
curl --request POST \
--url https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"txn_ref_id": "<string>",
"txn_type": "PURCHASE",
"authorization_code": "<string>",
"response_code": "<string>",
"amount_paid": "<string>",
"product_statuses": [
{
"product_id": "<string>",
"product_ref_id": "<string>",
"amount_paid": "<string>"
}
]
}
'import requests
url = "https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status"
payload = {
"txn_ref_id": "<string>",
"txn_type": "PURCHASE",
"authorization_code": "<string>",
"response_code": "<string>",
"amount_paid": "<string>",
"product_statuses": [
{
"product_id": "<string>",
"product_ref_id": "<string>",
"amount_paid": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
txn_ref_id: '<string>',
txn_type: 'PURCHASE',
authorization_code: '<string>',
response_code: '<string>',
amount_paid: '<string>',
product_statuses: [{product_id: '<string>', product_ref_id: '<string>', amount_paid: '<string>'}]
})
};
fetch('https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status', 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://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status",
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([
'txn_ref_id' => '<string>',
'txn_type' => 'PURCHASE',
'authorization_code' => '<string>',
'response_code' => '<string>',
'amount_paid' => '<string>',
'product_statuses' => [
[
'product_id' => '<string>',
'product_ref_id' => '<string>',
'amount_paid' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status"
payload := strings.NewReader("{\n \"txn_ref_id\": \"<string>\",\n \"txn_type\": \"PURCHASE\",\n \"authorization_code\": \"<string>\",\n \"response_code\": \"<string>\",\n \"amount_paid\": \"<string>\",\n \"product_statuses\": [\n {\n \"product_id\": \"<string>\",\n \"product_ref_id\": \"<string>\",\n \"amount_paid\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"txn_ref_id\": \"<string>\",\n \"txn_type\": \"PURCHASE\",\n \"authorization_code\": \"<string>\",\n \"response_code\": \"<string>\",\n \"amount_paid\": \"<string>\",\n \"product_statuses\": [\n {\n \"product_id\": \"<string>\",\n \"product_ref_id\": \"<string>\",\n \"amount_paid\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.prava.space/v1/sessions/{sessionId}/report-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"txn_ref_id\": \"<string>\",\n \"txn_type\": \"PURCHASE\",\n \"authorization_code\": \"<string>\",\n \"response_code\": \"<string>\",\n \"amount_paid\": \"<string>\",\n \"product_statuses\": [\n {\n \"product_id\": \"<string>\",\n \"product_ref_id\": \"<string>\",\n \"amount_paid\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"txn_ref_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Always report status after checkout execution: this updates transaction records and relays the
outcome to the card network. Report
DECLINED if a payment token was used but checkout failed.Notes
- A mandate is the spending permission created when the cardholder approved the payment. Mandates are
currently one-time: an
APPROVEDstatus automatically consumes the mandate (it can’t be reused). Recurring mandate frequencies are planned; once available,APPROVEDwill keep a recurring mandate active for future invocations. product_statusesis optional and informational; the overall mandate status followstxn_status.
Error responses
| Status | Code | Cause | Resolution |
|---|---|---|---|
| 401 | AUTH_1001 | Invalid API key | Check your secret key |
| 401 | AUTH_1002 | Missing or invalid Authorization header | Include Authorization: Bearer sk_xxx |
| 404 | NOT_FOUND | Session / order / transaction reference not found | Verify the session ID and txn_ref_id |
| 400 | INVALID_STATE | No transaction awaiting payment result | May already be reported, or not yet ready |
| 400 | MANDATE_EXPIRED | Mandate has expired | Register a new intent |
| 400 | PRODUCT_NOT_FOUND | Product not found by the given ID | Verify product_id or product_ref_id |
| 502 | VISA_CONFIRMATION_FAILED | Card network confirmation failed | Retry or contact support |
| 500 | REPORT_STATUS_ERROR | Internal error | Contact support with the X-Response-ID header |
Authorizations
Your secret key: sk_test_* (sandbox) or sk_live_* (production).
Path Parameters
The session ID returned from Create Session
Body
application/json
The transaction line item reference ID (from Get Payment Result)
The payment outcome
Available options:
APPROVED, DECLINED Transaction type
Authorization code from the merchant's payment processor
Maximum string length:
128Processor response code, e.g. "00" for approved
Maximum string length:
2Override the total amount paid, if different from the original
Optional per-product status overrides
Show child attributes
Show child attributes
⌘I