Pay an order (embedded Accept.js)
curl --request POST \
--url https://vitarelay.com/api/public/v1/orders/{id}/pay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"opaque_data": {
"dataDescriptor": "<string>",
"dataValue": "<string>"
}
}
'import requests
url = "https://vitarelay.com/api/public/v1/orders/{id}/pay"
payload = { "opaque_data": {
"dataDescriptor": "<string>",
"dataValue": "<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({opaque_data: {dataDescriptor: '<string>', dataValue: '<string>'}})
};
fetch('https://vitarelay.com/api/public/v1/orders/{id}/pay', 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://vitarelay.com/api/public/v1/orders/{id}/pay",
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([
'opaque_data' => [
'dataDescriptor' => '<string>',
'dataValue' => '<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://vitarelay.com/api/public/v1/orders/{id}/pay"
payload := strings.NewReader("{\n \"opaque_data\": {\n \"dataDescriptor\": \"<string>\",\n \"dataValue\": \"<string>\"\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://vitarelay.com/api/public/v1/orders/{id}/pay")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"opaque_data\": {\n \"dataDescriptor\": \"<string>\",\n \"dataValue\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vitarelay.com/api/public/v1/orders/{id}/pay")
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 \"opaque_data\": {\n \"dataDescriptor\": \"<string>\",\n \"dataValue\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"paid": true,
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transaction_id": "<string>",
"payment_status": "paid"
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"paid": false,
"error": "<string>",
"reason": "declined"
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}Orders
Pay an order (embedded Accept.js)
Vita Clinic only. Requires the orders:write scope.
The embedded patient-checkout flow has three steps:
- Create the order with
billing_mode=patient_checkout(POST /orders). The order is created UNPAID and the response carries acheckoutobject. - On your own page (your branding, your domain), load
checkout.accept_js_urland callAccept.dispatchDatawithcheckout.public_client_key+checkout.api_login_idto tokenize the card in the browser. Card data never touches your server or VitaRelay’s — you receive a single-use opaque nonce. - POST that nonce here as
opaque_data.
VitaRelay charges its own Authorize.Net account (merchant of record);
on success the order is marked paid and clinic markup accrues to
payouts exactly as it does for card-on-file orders. Paying an
already-paid order is a no-op that returns paid: true.
POST
/
orders
/
{id}
/
pay
Pay an order (embedded Accept.js)
curl --request POST \
--url https://vitarelay.com/api/public/v1/orders/{id}/pay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"opaque_data": {
"dataDescriptor": "<string>",
"dataValue": "<string>"
}
}
'import requests
url = "https://vitarelay.com/api/public/v1/orders/{id}/pay"
payload = { "opaque_data": {
"dataDescriptor": "<string>",
"dataValue": "<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({opaque_data: {dataDescriptor: '<string>', dataValue: '<string>'}})
};
fetch('https://vitarelay.com/api/public/v1/orders/{id}/pay', 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://vitarelay.com/api/public/v1/orders/{id}/pay",
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([
'opaque_data' => [
'dataDescriptor' => '<string>',
'dataValue' => '<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://vitarelay.com/api/public/v1/orders/{id}/pay"
payload := strings.NewReader("{\n \"opaque_data\": {\n \"dataDescriptor\": \"<string>\",\n \"dataValue\": \"<string>\"\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://vitarelay.com/api/public/v1/orders/{id}/pay")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"opaque_data\": {\n \"dataDescriptor\": \"<string>\",\n \"dataValue\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vitarelay.com/api/public/v1/orders/{id}/pay")
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 \"opaque_data\": {\n \"dataDescriptor\": \"<string>\",\n \"dataValue\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"paid": true,
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transaction_id": "<string>",
"payment_status": "paid"
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"paid": false,
"error": "<string>",
"reason": "declined"
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid"
}
}Authorizations
API key issued by VitaRelay. Send as Authorization: Bearer vr_live_…
(production) or Authorization: Bearer vr_test_… (sandbox).
Path Parameters
Order UUID.
Body
application/json
The Accept.js nonce returned by Accept.dispatchData.
Show child attributes
Show child attributes

