using RestSharp;
var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PUT", 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.put("https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
]),
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;
}import requests
url = "https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"type": "checkout-session",
"id": "8d3fe99b-1422-42e6-bbb3-932d95ae5f79",
"expires_at": "2022-01-01T00:00:00+00:00",
"cart_items": [
{
"name": "GoPro HERO9 Camcorder",
"quantity": 1,
"unit_amount": 37999,
"discount_amount": 0,
"tax_amount": 0,
"external_identifier": "item-789123",
"sku": "sku-789123",
"product_url": "https://example.com/items/gopro",
"image_url": "https://example.com/images/items/gopro.png",
"categories": [
"<string>"
],
"product_type": "physical",
"seller_country": "US"
}
],
"metadata": {
"key": "value"
},
"airline": {
"passenger_name_record": "JOHN L",
"booking_code": "X36Q9C",
"ticket_number": "123-1234-151555",
"ticket_delivery_method": "other",
"issued_at": "2013-07-16T19:23:00.000+00:00",
"issued_address": "123 Broadway, New York",
"travel_agency_code": "12345",
"travel_agency_name": "Agency name",
"travel_agency_invoice_number": "EG15555155",
"travel_agency_plan_name": "B733",
"restricted_ticket": false,
"issuing_carrier_code": "A3",
"issuing_carrier_name": "Aegean Airlines",
"issuing_iata_designator": "A3",
"issuing_icao_code": "AEE",
"reservation_system": "Amadeus",
"is_cardholder_traveling": false,
"passengers": [
{
"title": "Mr.",
"first_name": "John",
"last_name": "Lunn",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"passport_number": "7700225",
"ticket_number": "LH1236699999",
"frequent_flyer_number": "15885566",
"date_of_birth": "2013-07-16",
"age_group": "adult"
}
],
"legs": [
{
"carrier_code": "LY",
"carrier_name": "El Al Israel Airlines",
"iata_designator": "LY",
"icao_code": "ELY",
"flight_number": "BA98",
"departure_at": "2013-07-16T19:23:00.000+00:00",
"departure_country": "UK",
"departure_city": "London",
"departure_airport": "LHR",
"arrival_at": "2013-07-16T19:23:00.000+00:00",
"arrival_country": "UK",
"arrival_city": "London",
"arrival_airport": "LHR",
"fare_basis_code": "WH7LNR",
"flight_class": "E",
"stop_over": false,
"route_type": "round_trip",
"coupon_number": "15885566",
"fare_amount": 100,
"fee_amount": 100,
"tax_amount": 100,
"departure_tax_amount": 100,
"seat_class": "F"
}
]
},
"payment_method": {
"type": "payment_method",
"id": "<string>",
"method": "card",
"scheme": "visa",
"label": "4242",
"details": {
"bin": "411111",
"card_type": "credit",
"card_country": "US",
"card_issuer_name": "Bank"
},
"fingerprint": "20eb353620155d2b5fc864cc46a73ea77cb92c725238650839da1813fa987a17"
}
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Missing '****' field",
"details": [
{
"location": "body",
"type": "value_error.missing",
"pointer": "/payment_method/number",
"message": "field required"
}
]
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "A duplicate record exists with this external_identifier value",
"details": []
}Update checkout session
using RestSharp;
var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PUT", 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.put("https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
]),
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;
}import requests
url = "https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://api.sandbox.{id}.gr4vy.app/checkout/sessions/{checkout_session_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"type": "checkout-session",
"id": "8d3fe99b-1422-42e6-bbb3-932d95ae5f79",
"expires_at": "2022-01-01T00:00:00+00:00",
"cart_items": [
{
"name": "GoPro HERO9 Camcorder",
"quantity": 1,
"unit_amount": 37999,
"discount_amount": 0,
"tax_amount": 0,
"external_identifier": "item-789123",
"sku": "sku-789123",
"product_url": "https://example.com/items/gopro",
"image_url": "https://example.com/images/items/gopro.png",
"categories": [
"<string>"
],
"product_type": "physical",
"seller_country": "US"
}
],
"metadata": {
"key": "value"
},
"airline": {
"passenger_name_record": "JOHN L",
"booking_code": "X36Q9C",
"ticket_number": "123-1234-151555",
"ticket_delivery_method": "other",
"issued_at": "2013-07-16T19:23:00.000+00:00",
"issued_address": "123 Broadway, New York",
"travel_agency_code": "12345",
"travel_agency_name": "Agency name",
"travel_agency_invoice_number": "EG15555155",
"travel_agency_plan_name": "B733",
"restricted_ticket": false,
"issuing_carrier_code": "A3",
"issuing_carrier_name": "Aegean Airlines",
"issuing_iata_designator": "A3",
"issuing_icao_code": "AEE",
"reservation_system": "Amadeus",
"is_cardholder_traveling": false,
"passengers": [
{
"title": "Mr.",
"first_name": "John",
"last_name": "Lunn",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"passport_number": "7700225",
"ticket_number": "LH1236699999",
"frequent_flyer_number": "15885566",
"date_of_birth": "2013-07-16",
"age_group": "adult"
}
],
"legs": [
{
"carrier_code": "LY",
"carrier_name": "El Al Israel Airlines",
"iata_designator": "LY",
"icao_code": "ELY",
"flight_number": "BA98",
"departure_at": "2013-07-16T19:23:00.000+00:00",
"departure_country": "UK",
"departure_city": "London",
"departure_airport": "LHR",
"arrival_at": "2013-07-16T19:23:00.000+00:00",
"arrival_country": "UK",
"arrival_city": "London",
"arrival_airport": "LHR",
"fare_basis_code": "WH7LNR",
"flight_class": "E",
"stop_over": false,
"route_type": "round_trip",
"coupon_number": "15885566",
"fare_amount": 100,
"fee_amount": 100,
"tax_amount": 100,
"departure_tax_amount": 100,
"seat_class": "F"
}
]
},
"payment_method": {
"type": "payment_method",
"id": "<string>",
"method": "card",
"scheme": "visa",
"label": "4242",
"details": {
"bin": "411111",
"card_type": "credit",
"card_country": "US",
"card_issuer_name": "Bank"
},
"fingerprint": "20eb353620155d2b5fc864cc46a73ea77cb92c725238650839da1813fa987a17"
}
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Missing '****' field",
"details": [
{
"location": "body",
"type": "value_error.missing",
"pointer": "/payment_method/number",
"message": "field required"
}
]
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "A duplicate record exists with this external_identifier value",
"details": []
}checkout-sessions.write scope.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique ID for a Checkout Session.
"8724fd24-5489-4a5d-90fd-0604df7d3b83"
Body
A request to update a checkout session.
An array of cart items that represents the line items of a transaction.
Show child attributes
Show child attributes
Any additional information about the transaction that you would like to store as key-value pairs. This data is passed to payment service providers that support it.
Show child attributes
Show child attributes
{ "key": "value" }
The airline addendum data which describes the airline booking associated with this transaction.
Show child attributes
Show child attributes
Response
Returns the updated Checkout Session.
A short-lived checkout session.
checkout-session.
checkout-session "checkout-session"
The ID of the Checkout Session.
"8d3fe99b-1422-42e6-bbb3-932d95ae5f79"
The date and time when the Checkout Session will expire. By default this will be set to 1 hour from the date of creation.
"2022-01-01T00:00:00+00:00"
An array of cart items that represents the line items of a transaction.
Show child attributes
Show child attributes
Any additional information about the transaction that you would like to store as key-value pairs. This data is passed to payment service providers that support it.
Show child attributes
Show child attributes
{ "key": "value" }
Contains information about an airline travel, if applicable.
Show child attributes
Show child attributes
Details about the payment method for card type only.
Show child attributes
Show child attributes
Was this page helpful?