Skip to main content
POST
/
v1
/
order_batches
/
price
Calculate the price for an order batch
curl --request POST \
  --url https://api.ongoody.com/v1/order_batches/price \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "send_method": "direct_send",
  "recipients": [
    {
      "first_name": "Alena",
      "last_name": "Kenter",
      "email": "alena@example.com",
      "mailing_address": {
        "first_name": "Alena",
        "last_name": "Kenter",
        "address_1": "140 E 55th St",
        "address_2": "",
        "city": "New York",
        "state": "NY",
        "postal_code": "10022",
        "country": "US"
      }
    }
  ],
  "cart": {
    "items": [
      {
        "product_id": "65c4e577-4226-4a2f-8298-aaffd3e34081",
        "quantity": 1
      }
    ]
  }
}
'
import requests

url = "https://api.ongoody.com/v1/order_batches/price"

payload = {
"send_method": "direct_send",
"recipients": [
{
"first_name": "Alena",
"last_name": "Kenter",
"email": "alena@example.com",
"mailing_address": {
"first_name": "Alena",
"last_name": "Kenter",
"address_1": "140 E 55th St",
"address_2": "",
"city": "New York",
"state": "NY",
"postal_code": "10022",
"country": "US"
}
}
],
"cart": { "items": [
{
"product_id": "65c4e577-4226-4a2f-8298-aaffd3e34081",
"quantity": 1
}
] }
}
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({
send_method: 'direct_send',
recipients: [
{
first_name: 'Alena',
last_name: 'Kenter',
email: 'alena@example.com',
mailing_address: {
first_name: 'Alena',
last_name: 'Kenter',
address_1: '140 E 55th St',
address_2: '',
city: 'New York',
state: 'NY',
postal_code: '10022',
country: 'US'
}
}
],
cart: {items: [{product_id: '65c4e577-4226-4a2f-8298-aaffd3e34081', quantity: 1}]}
})
};

fetch('https://api.ongoody.com/v1/order_batches/price', 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.ongoody.com/v1/order_batches/price",
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([
'send_method' => 'direct_send',
'recipients' => [
[
'first_name' => 'Alena',
'last_name' => 'Kenter',
'email' => 'alena@example.com',
'mailing_address' => [
'first_name' => 'Alena',
'last_name' => 'Kenter',
'address_1' => '140 E 55th St',
'address_2' => '',
'city' => 'New York',
'state' => 'NY',
'postal_code' => '10022',
'country' => 'US'
]
]
],
'cart' => [
'items' => [
[
'product_id' => '65c4e577-4226-4a2f-8298-aaffd3e34081',
'quantity' => 1
]
]
]
]),
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://api.ongoody.com/v1/order_batches/price"

payload := strings.NewReader("{\n \"send_method\": \"direct_send\",\n \"recipients\": [\n {\n \"first_name\": \"Alena\",\n \"last_name\": \"Kenter\",\n \"email\": \"alena@example.com\",\n \"mailing_address\": {\n \"first_name\": \"Alena\",\n \"last_name\": \"Kenter\",\n \"address_1\": \"140 E 55th St\",\n \"address_2\": \"\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10022\",\n \"country\": \"US\"\n }\n }\n ],\n \"cart\": {\n \"items\": [\n {\n \"product_id\": \"65c4e577-4226-4a2f-8298-aaffd3e34081\",\n \"quantity\": 1\n }\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://api.ongoody.com/v1/order_batches/price")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"send_method\": \"direct_send\",\n \"recipients\": [\n {\n \"first_name\": \"Alena\",\n \"last_name\": \"Kenter\",\n \"email\": \"alena@example.com\",\n \"mailing_address\": {\n \"first_name\": \"Alena\",\n \"last_name\": \"Kenter\",\n \"address_1\": \"140 E 55th St\",\n \"address_2\": \"\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10022\",\n \"country\": \"US\"\n }\n }\n ],\n \"cart\": {\n \"items\": [\n {\n \"product_id\": \"65c4e577-4226-4a2f-8298-aaffd3e34081\",\n \"quantity\": 1\n }\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ongoody.com/v1/order_batches/price")

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 \"send_method\": \"direct_send\",\n \"recipients\": [\n {\n \"first_name\": \"Alena\",\n \"last_name\": \"Kenter\",\n \"email\": \"alena@example.com\",\n \"mailing_address\": {\n \"first_name\": \"Alena\",\n \"last_name\": \"Kenter\",\n \"address_1\": \"140 E 55th St\",\n \"address_2\": \"\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10022\",\n \"country\": \"US\"\n }\n }\n ],\n \"cart\": {\n \"items\": [\n {\n \"product_id\": \"65c4e577-4226-4a2f-8298-aaffd3e34081\",\n \"quantity\": 1\n }\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "cart_price": {
    "price_product": 1000,
    "price_shipping": 1000,
    "price_processing_fee": 100,
    "price_pre_tax": 2100,
    "price_est_tax_low": 0,
    "price_est_tax_high": 210,
    "price_est_total_low": 2100,
    "price_est_total_high": 2310
  },
  "total_price": {
    "recipients": 2,
    "est_group_total_low": 4200,
    "est_group_total_high": 4620
  }
}
You can calculate the total price for an order batch before you create it, given a cart, recipients, and send method. To use a specific address, pass the direct_send send method.

Authorizations

Authorization
string
header
required

Your Goody API key.

Body

application/json

Input parameters for an order batch price calculation.

recipients
object[]
required
cart
object
required
send_method
enum<string>
required

The method for sending a order batch. email_and_link sends a gift email to the recipient (specify email for each recipient). link_multiple_custom_list generates a gift link without an automatic email. direct_send ships the product directly to the recipient (specify mailing_address for each recipient). For more information, see Send Methods.

Available options:
email_and_link,
link_multiple_custom_list,
direct_send

Response

Order batch price calculated

The price for an order batch (all in cents).

cart_price_estimate
object

Prices for a single recipient's cart in cents. This represents the price for each recipient in the order batch.

total_price_estimate
object

Total price estimates for the entire order batch in cents. This includes all recipients.