C#
using Gr4vy;
using Gr4vy.Models.Components;
using NodaTime;
using System;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
id: "example",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.CheckoutSessions.CreateAsync(checkoutSessionCreate: new CheckoutSessionCreate() {
CartItems = new List<CartItem>() {
new CartItem() {
Name = "GoPro HD",
Quantity = 2,
UnitAmount = 1299,
DiscountAmount = 0,
TaxAmount = 0,
ExternalIdentifier = "goprohd",
Sku = "GPHD1078",
ProductUrl = "https://example.com/catalog/go-pro-hd",
ImageUrl = "https://example.com/images/go-pro-hd.jpg",
Categories = new List<string>() {
"camera",
"travel",
"gear",
},
ProductType = ProductType.Physical,
SellerCountry = "GB",
},
new CartItem() {
Name = "GoPro HD",
Quantity = 2,
UnitAmount = 1299,
DiscountAmount = 0,
TaxAmount = 0,
ExternalIdentifier = "goprohd",
Sku = "GPHD1078",
ProductUrl = "https://example.com/catalog/go-pro-hd",
ImageUrl = "https://example.com/images/go-pro-hd.jpg",
Categories = new List<string>() {
"camera",
"travel",
"gear",
},
ProductType = ProductType.Physical,
SellerCountry = "GB",
},
new CartItem() {
Name = "GoPro HD",
Quantity = 2,
UnitAmount = 1299,
DiscountAmount = 0,
TaxAmount = 0,
ExternalIdentifier = "goprohd",
Sku = "GPHD1078",
ProductUrl = "https://example.com/catalog/go-pro-hd",
ImageUrl = "https://example.com/images/go-pro-hd.jpg",
Categories = new List<string>() {
"camera",
"travel",
"gear",
},
ProductType = ProductType.Physical,
SellerCountry = "US",
},
},
Metadata = new Dictionary<string, string>() {
{ "cohort", "cohort-a" },
{ "order_id", "order-12345" },
},
Buyer = new GuestBuyer() {
DisplayName = "John Doe",
ExternalIdentifier = "buyer-12345",
BillingDetails = new BillingDetails() {
FirstName = "John",
LastName = "Doe",
EmailAddress = "john@example.com",
PhoneNumber = "+1234567890",
Address = new Address() {
City = "San Jose",
Country = "US",
PostalCode = "94560",
State = "California",
StateCode = "US-CA",
HouseNumberOrName = "10",
Line1 = "Stafford Appartments",
Line2 = "29th Street",
Organization = "Gr4vy",
},
TaxId = new TaxId() {
Value = "12345678931",
Kind = TaxIdKind.ArCuit,
},
},
ShippingDetails = new ShippingDetailsCreate() {
FirstName = "John",
LastName = "Doe",
EmailAddress = "john@example.com",
PhoneNumber = "+1234567890",
Address = new Address() {
City = "San Jose",
Country = "US",
PostalCode = "94560",
State = "California",
StateCode = "US-CA",
HouseNumberOrName = "10",
Line1 = "Stafford Appartments",
Line2 = "29th Street",
Organization = "Gr4vy",
},
},
},
Airline = new Airline() {
BookingCode = "X36Q9C",
IsCardholderTraveling = true,
IssuedAddress = "123 Broadway, New York",
IssuedAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
IssuingCarrierCode = "649",
IssuingCarrierName = "Air Transat A.T. Inc",
IssuingIataDesignator = "TS",
IssuingIcaoCode = "TSC",
Legs = new List<AirlineLeg>() {
new AirlineLeg() {
ArrivalAirport = "LAX",
ArrivalAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
ArrivalCity = "Los Angeles",
ArrivalCountry = "US",
CarrierCode = "649",
CarrierName = "Air Transat A.T. Inc",
IataDesignator = "TS",
IcaoCode = "TSC",
CouponNumber = "15885566",
DepartureAirport = "LHR",
DepartureAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
DepartureCity = "London",
DepartureCountry = "GB",
DepartureTaxAmount = 1200,
FareAmount = 129900,
FareBasisCode = "FY",
FeeAmount = 1200,
FlightClass = "E",
FlightNumber = "101",
RouteType = RouteType.RoundTrip,
SeatClass = "F",
StopOver = false,
TaxAmount = 1200,
},
new AirlineLeg() {
ArrivalAirport = "LAX",
ArrivalAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
ArrivalCity = "Los Angeles",
ArrivalCountry = "US",
CarrierCode = "649",
CarrierName = "Air Transat A.T. Inc",
IataDesignator = "TS",
IcaoCode = "TSC",
CouponNumber = "15885566",
DepartureAirport = "LHR",
DepartureAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
DepartureCity = "London",
DepartureCountry = "GB",
DepartureTaxAmount = 1200,
FareAmount = 129900,
FareBasisCode = "FY",
FeeAmount = 1200,
FlightClass = "E",
FlightNumber = "101",
RouteType = RouteType.RoundTrip,
SeatClass = "F",
StopOver = false,
TaxAmount = 1200,
},
new AirlineLeg() {
ArrivalAirport = "LAX",
ArrivalAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
ArrivalCity = "Los Angeles",
ArrivalCountry = "US",
CarrierCode = "649",
CarrierName = "Air Transat A.T. Inc",
IataDesignator = "TS",
IcaoCode = "TSC",
CouponNumber = "15885566",
DepartureAirport = "LHR",
DepartureAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
DepartureCity = "London",
DepartureCountry = "GB",
DepartureTaxAmount = 1200,
FareAmount = 129900,
FareBasisCode = "FY",
FeeAmount = 1200,
FlightClass = "E",
FlightNumber = "101",
RouteType = RouteType.RoundTrip,
SeatClass = "F",
StopOver = false,
TaxAmount = 1200,
},
},
PassengerNameRecord = "JOHN L",
Passengers = new List<AirlinePassenger>() {
new AirlinePassenger() {
AgeGroup = AgeGroup.Adult,
DateOfBirth = LocalDate.FromDateTime(System.DateTime.Parse("2013-07-16")),
EmailAddress = "john@example.com",
FirstName = "John",
FrequentFlyerNumber = "15885566",
LastName = "Luhn",
PassportNumber = "11117700225",
PhoneNumber = "+1234567890",
TicketNumber = "BA1236699999",
Title = "Mr.",
CountryCode = "US",
},
new AirlinePassenger() {
AgeGroup = AgeGroup.Adult,
DateOfBirth = LocalDate.FromDateTime(System.DateTime.Parse("2013-07-16")),
EmailAddress = "john@example.com",
FirstName = "John",
FrequentFlyerNumber = "15885566",
LastName = "Luhn",
PassportNumber = "11117700225",
PhoneNumber = "+1234567890",
TicketNumber = "BA1236699999",
Title = "Mr.",
CountryCode = "US",
},
},
ReservationSystem = "Amadeus",
RestrictedTicket = false,
TicketDeliveryMethod = TicketDeliveryMethod.Electronic,
TicketNumber = "123-1234-151555",
TravelAgencyCode = "12345",
TravelAgencyInvoiceNumber = "EG15555155",
TravelAgencyName = "ACME Agency",
TravelAgencyPlanName = "B733",
},
});
// handle responsepackage main
import(
"context"
"os"
gr4vygo "github.com/gr4vy/gr4vy-go"
"github.com/gr4vy/gr4vy-go/models/components"
"github.com/gr4vy/gr4vy-go/types"
"log"
)
func main() {
ctx := context.Background()
s := gr4vygo.New(
gr4vygo.WithMerchantAccountID("default"),
gr4vygo.WithSecurity(os.Getenv("GR4VY_BEARER_AUTH")),
)
res, err := s.CheckoutSessions.Create(ctx, nil, &components.CheckoutSessionCreate{
CartItems: []components.CartItem{
components.CartItem{
Name: "GoPro HD",
Quantity: 2,
UnitAmount: 1299,
DiscountAmount: gr4vygo.Pointer[int64](0),
TaxAmount: gr4vygo.Pointer[int64](0),
ExternalIdentifier: gr4vygo.Pointer("goprohd"),
Sku: gr4vygo.Pointer("GPHD1078"),
ProductURL: gr4vygo.Pointer("https://example.com/catalog/go-pro-hd"),
ImageURL: gr4vygo.Pointer("https://example.com/images/go-pro-hd.jpg"),
Categories: []string{
"camera",
"travel",
"gear",
},
ProductType: components.ProductTypePhysical.ToPointer(),
SellerCountry: gr4vygo.Pointer("US"),
},
components.CartItem{
Name: "GoPro HD",
Quantity: 2,
UnitAmount: 1299,
DiscountAmount: gr4vygo.Pointer[int64](0),
TaxAmount: gr4vygo.Pointer[int64](0),
ExternalIdentifier: gr4vygo.Pointer("goprohd"),
Sku: gr4vygo.Pointer("GPHD1078"),
ProductURL: gr4vygo.Pointer("https://example.com/catalog/go-pro-hd"),
ImageURL: gr4vygo.Pointer("https://example.com/images/go-pro-hd.jpg"),
Categories: []string{
"camera",
"travel",
"gear",
},
ProductType: components.ProductTypePhysical.ToPointer(),
SellerCountry: gr4vygo.Pointer("US"),
},
},
Metadata: map[string]string{
"cohort": "cohort-a",
"order_id": "order-12345",
},
Buyer: nil,
Airline: &components.Airline{
BookingCode: gr4vygo.Pointer("X36Q9C"),
IsCardholderTraveling: gr4vygo.Pointer(true),
IssuedAddress: gr4vygo.Pointer("123 Broadway, New York"),
IssuedAt: types.MustNewTimeFromString("2013-07-16T19:23:00.000+00:00"),
IssuingCarrierCode: gr4vygo.Pointer("649"),
IssuingCarrierName: gr4vygo.Pointer("Air Transat A.T. Inc"),
IssuingIataDesignator: gr4vygo.Pointer("TS"),
IssuingIcaoCode: gr4vygo.Pointer("TSC"),
Legs: []components.AirlineLeg{
components.AirlineLeg{
ArrivalAirport: gr4vygo.Pointer("LAX"),
ArrivalAt: types.MustNewTimeFromString("2013-07-16T19:23:00.000+00:00"),
ArrivalCity: gr4vygo.Pointer("Los Angeles"),
ArrivalCountry: gr4vygo.Pointer("US"),
CarrierCode: gr4vygo.Pointer("649"),
CarrierName: gr4vygo.Pointer("Air Transat A.T. Inc"),
IataDesignator: gr4vygo.Pointer("TS"),
IcaoCode: gr4vygo.Pointer("TSC"),
CouponNumber: gr4vygo.Pointer("15885566"),
DepartureAirport: gr4vygo.Pointer("LHR"),
DepartureAt: types.MustNewTimeFromString("2013-07-16T19:23:00.000+00:00"),
DepartureCity: gr4vygo.Pointer("London"),
DepartureCountry: gr4vygo.Pointer("GB"),
DepartureTaxAmount: gr4vygo.Pointer[int64](1200),
FareAmount: gr4vygo.Pointer[int64](129900),
FareBasisCode: gr4vygo.Pointer("FY"),
FeeAmount: gr4vygo.Pointer[int64](1200),
FlightClass: gr4vygo.Pointer("E"),
FlightNumber: gr4vygo.Pointer("101"),
RouteType: components.RouteTypeRoundTrip.ToPointer(),
SeatClass: gr4vygo.Pointer("F"),
StopOver: gr4vygo.Pointer(false),
TaxAmount: gr4vygo.Pointer[int64](1200),
},
},
PassengerNameRecord: gr4vygo.Pointer("JOHN L"),
Passengers: []components.AirlinePassenger{
components.AirlinePassenger{
AgeGroup: components.AgeGroupAdult.ToPointer(),
DateOfBirth: types.MustNewDateFromString("2013-07-16"),
EmailAddress: gr4vygo.Pointer("john@example.com"),
FirstName: gr4vygo.Pointer("John"),
FrequentFlyerNumber: gr4vygo.Pointer("15885566"),
LastName: gr4vygo.Pointer("Luhn"),
PassportNumber: gr4vygo.Pointer("11117700225"),
PhoneNumber: gr4vygo.Pointer("+1234567890"),
TicketNumber: gr4vygo.Pointer("BA1236699999"),
Title: gr4vygo.Pointer("Mr."),
CountryCode: gr4vygo.Pointer("US"),
},
components.AirlinePassenger{
AgeGroup: components.AgeGroupAdult.ToPointer(),
DateOfBirth: types.MustNewDateFromString("2013-07-16"),
EmailAddress: gr4vygo.Pointer("john@example.com"),
FirstName: gr4vygo.Pointer("John"),
FrequentFlyerNumber: gr4vygo.Pointer("15885566"),
LastName: gr4vygo.Pointer("Luhn"),
PassportNumber: gr4vygo.Pointer("11117700225"),
PhoneNumber: gr4vygo.Pointer("+1234567890"),
TicketNumber: gr4vygo.Pointer("BA1236699999"),
Title: gr4vygo.Pointer("Mr."),
CountryCode: gr4vygo.Pointer("US"),
},
},
ReservationSystem: gr4vygo.Pointer("Amadeus"),
RestrictedTicket: gr4vygo.Pointer(false),
TicketDeliveryMethod: components.TicketDeliveryMethodElectronic.ToPointer(),
TicketNumber: gr4vygo.Pointer("123-1234-151555"),
TravelAgencyCode: gr4vygo.Pointer("12345"),
TravelAgencyInvoiceNumber: gr4vygo.Pointer("EG15555155"),
TravelAgencyName: gr4vygo.Pointer("ACME Agency"),
TravelAgencyPlanName: gr4vygo.Pointer("B733"),
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}package hello.world;
import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.*;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.CreateCheckoutSessionResponse;
import java.lang.Exception;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
public class Application {
public static void main(String[] args) throws Exception {
Gr4vy sdk = Gr4vy.builder()
.merchantAccountId("default")
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
CreateCheckoutSessionResponse res = sdk.checkoutSessions().create()
.checkoutSessionCreate(CheckoutSessionCreate.builder()
.cartItems(List.of(
CartItem.builder()
.name("GoPro HD")
.quantity(2L)
.unitAmount(1299L)
.discountAmount(0L)
.taxAmount(0L)
.externalIdentifier("goprohd")
.sku("GPHD1078")
.productUrl("https://example.com/catalog/go-pro-hd")
.imageUrl("https://example.com/images/go-pro-hd.jpg")
.categories(List.of(
"camera",
"travel",
"gear"))
.productType(ProductType.PHYSICAL)
.sellerCountry("US")
.build(),
CartItem.builder()
.name("GoPro HD")
.quantity(2L)
.unitAmount(1299L)
.discountAmount(0L)
.taxAmount(0L)
.externalIdentifier("goprohd")
.sku("GPHD1078")
.productUrl("https://example.com/catalog/go-pro-hd")
.imageUrl("https://example.com/images/go-pro-hd.jpg")
.categories(List.of(
"camera",
"travel",
"gear"))
.productType(ProductType.PHYSICAL)
.sellerCountry("US")
.build()))
.metadata(Map.ofEntries(
Map.entry("cohort", "cohort-a"),
Map.entry("order_id", "order-12345")))
.buyer(JsonNullable.of(null))
.airline(Airline.builder()
.bookingCode("X36Q9C")
.isCardholderTraveling(true)
.issuedAddress("123 Broadway, New York")
.issuedAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00"))
.issuingCarrierCode("649")
.issuingCarrierName("Air Transat A.T. Inc")
.issuingIataDesignator("TS")
.issuingIcaoCode("TSC")
.legs(List.of(
AirlineLeg.builder()
.arrivalAirport("LAX")
.arrivalAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00"))
.arrivalCity("Los Angeles")
.arrivalCountry("US")
.carrierCode("649")
.carrierName("Air Transat A.T. Inc")
.iataDesignator("TS")
.icaoCode("TSC")
.couponNumber("15885566")
.departureAirport("LHR")
.departureAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00"))
.departureCity("London")
.departureCountry("GB")
.departureTaxAmount(1200L)
.fareAmount(129900L)
.fareBasisCode("FY")
.feeAmount(1200L)
.flightClass("E")
.flightNumber("101")
.routeType(RouteType.ROUND_TRIP)
.seatClass("F")
.stopOver(false)
.taxAmount(1200L)
.build()))
.passengerNameRecord("JOHN L")
.passengers(List.of(
AirlinePassenger.builder()
.ageGroup(AgeGroup.ADULT)
.dateOfBirth(LocalDate.parse("2013-07-16"))
.emailAddress("john@example.com")
.firstName("John")
.frequentFlyerNumber("15885566")
.lastName("Luhn")
.passportNumber("11117700225")
.phoneNumber("+1234567890")
.ticketNumber("BA1236699999")
.title("Mr.")
.countryCode("US")
.build(),
AirlinePassenger.builder()
.ageGroup(AgeGroup.ADULT)
.dateOfBirth(LocalDate.parse("2013-07-16"))
.emailAddress("john@example.com")
.firstName("John")
.frequentFlyerNumber("15885566")
.lastName("Luhn")
.passportNumber("11117700225")
.phoneNumber("+1234567890")
.ticketNumber("BA1236699999")
.title("Mr.")
.countryCode("US")
.build()))
.reservationSystem("Amadeus")
.restrictedTicket(false)
.ticketDeliveryMethod(TicketDeliveryMethod.ELECTRONIC)
.ticketNumber("123-1234-151555")
.travelAgencyCode("12345")
.travelAgencyInvoiceNumber("EG15555155")
.travelAgencyName("ACME Agency")
.travelAgencyPlanName("B733")
.build())
.build())
.call();
if (res.checkoutSession().isPresent()) {
System.out.println(res.checkoutSession().get());
}
}
}declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\DateTime\LocalDate;
use Gr4vy;
use Gr4vy\Utils;
$sdk = Gr4vy\SDK::builder()
->setId('example')
->setServer('sandbox')
->setSecuritySource(Auth::withToken($privateKey))
->setMerchantAccountId('default')
->build();
$checkoutSessionCreate = new Gr4vy\CheckoutSessionCreate(
cartItems: [
new Gr4vy\CartItem(
name: 'GoPro HD',
quantity: 2,
unitAmount: 1299,
discountAmount: 0,
taxAmount: 0,
externalIdentifier: 'goprohd',
sku: 'GPHD1078',
productUrl: 'https://example.com/catalog/go-pro-hd',
imageUrl: 'https://example.com/images/go-pro-hd.jpg',
categories: [
'camera',
'travel',
'gear',
],
productType: 'physical',
sellerCountry: 'US',
),
new Gr4vy\CartItem(
name: 'GoPro HD',
quantity: 2,
unitAmount: 1299,
discountAmount: 0,
taxAmount: 0,
externalIdentifier: 'goprohd',
sku: 'GPHD1078',
productUrl: 'https://example.com/catalog/go-pro-hd',
imageUrl: 'https://example.com/images/go-pro-hd.jpg',
categories: [
'camera',
'travel',
'gear',
],
productType: 'physical',
sellerCountry: 'US',
),
],
metadata: [
'cohort' => 'cohort-a',
'order_id' => 'order-12345',
],
buyer: new Gr4vy\GuestBuyer(
displayName: 'John Doe',
externalIdentifier: 'buyer-12345',
billingDetails: new Gr4vy\BillingDetails(
firstName: 'John',
lastName: 'Doe',
emailAddress: 'john@example.com',
phoneNumber: '+1234567890',
address: new Gr4vy\Address(
city: 'San Jose',
country: 'US',
postalCode: '94560',
state: 'California',
stateCode: 'US-CA',
houseNumberOrName: '10',
line1: 'Stafford Appartments',
line2: '29th Street',
organization: 'Gr4vy',
),
taxId: new Gr4vy\TaxId(
value: '12345678931',
kind: 'my.frp',
),
),
shippingDetails: new Gr4vy\ShippingDetailsCreate(
firstName: 'John',
lastName: 'Doe',
emailAddress: 'john@example.com',
phoneNumber: '+1234567890',
address: null,
),
),
airline: new Gr4vy\Airline(
bookingCode: 'X36Q9C',
isCardholderTraveling: true,
issuedAddress: '123 Broadway, New York',
issuedAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
issuingCarrierCode: '649',
issuingCarrierName: 'Air Transat A.T. Inc',
issuingIataDesignator: 'TS',
issuingIcaoCode: 'TSC',
legs: [
new Gr4vy\AirlineLeg(
arrivalAirport: 'LAX',
arrivalAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
arrivalCity: 'Los Angeles',
arrivalCountry: 'US',
carrierCode: '649',
carrierName: 'Air Transat A.T. Inc',
iataDesignator: 'TS',
icaoCode: 'TSC',
couponNumber: '15885566',
departureAirport: 'LHR',
departureAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
departureCity: 'London',
departureCountry: 'GB',
departureTaxAmount: 1200,
fareAmount: 129900,
fareBasisCode: 'FY',
feeAmount: 1200,
flightClass: 'E',
flightNumber: '101',
routeType: 'round_trip',
seatClass: 'F',
stopOver: false,
taxAmount: 1200,
),
new Gr4vy\AirlineLeg(
arrivalAirport: 'LAX',
arrivalAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
arrivalCity: 'Los Angeles',
arrivalCountry: 'US',
carrierCode: '649',
carrierName: 'Air Transat A.T. Inc',
iataDesignator: 'TS',
icaoCode: 'TSC',
couponNumber: '15885566',
departureAirport: 'LHR',
departureAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
departureCity: 'London',
departureCountry: 'GB',
departureTaxAmount: 1200,
fareAmount: 129900,
fareBasisCode: 'FY',
feeAmount: 1200,
flightClass: 'E',
flightNumber: '101',
routeType: 'round_trip',
seatClass: 'F',
stopOver: false,
taxAmount: 1200,
),
new Gr4vy\AirlineLeg(
arrivalAirport: 'LAX',
arrivalAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
arrivalCity: 'Los Angeles',
arrivalCountry: 'US',
carrierCode: '649',
carrierName: 'Air Transat A.T. Inc',
iataDesignator: 'TS',
icaoCode: 'TSC',
couponNumber: '15885566',
departureAirport: 'LHR',
departureAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
departureCity: 'London',
departureCountry: 'GB',
departureTaxAmount: 1200,
fareAmount: 129900,
fareBasisCode: 'FY',
feeAmount: 1200,
flightClass: 'E',
flightNumber: '101',
routeType: 'round_trip',
seatClass: 'F',
stopOver: false,
taxAmount: 1200,
),
],
passengerNameRecord: 'JOHN L',
passengers: [
new Gr4vy\AirlinePassenger(
ageGroup: 'adult',
dateOfBirth: LocalDate::parse('2013-07-16'),
emailAddress: 'john@example.com',
firstName: 'John',
frequentFlyerNumber: '15885566',
lastName: 'Luhn',
passportNumber: '11117700225',
phoneNumber: '+1234567890',
ticketNumber: 'BA1236699999',
title: 'Mr.',
countryCode: 'US',
),
new Gr4vy\AirlinePassenger(
ageGroup: 'adult',
dateOfBirth: LocalDate::parse('2013-07-16'),
emailAddress: 'john@example.com',
firstName: 'John',
frequentFlyerNumber: '15885566',
lastName: 'Luhn',
passportNumber: '11117700225',
phoneNumber: '+1234567890',
ticketNumber: 'BA1236699999',
title: 'Mr.',
countryCode: 'US',
),
],
reservationSystem: 'Amadeus',
restrictedTicket: false,
ticketDeliveryMethod: 'electronic',
ticketNumber: '123-1234-151555',
travelAgencyCode: '12345',
travelAgencyInvoiceNumber: 'EG15555155',
travelAgencyName: 'ACME Agency',
travelAgencyPlanName: 'B733',
),
);
$response = $sdk->checkoutSessions->create(
checkoutSessionCreate: $checkoutSessionCreate
);
if ($response->checkoutSession !== null) {
// handle response
}from datetime import date
from gr4vy import Gr4vy, models
from gr4vy.utils import parse_datetime
import os
with Gr4vy(
id="example",
server="sandbox",
merchant_account_id="default",
bearer_auth=auth.with_token(open("./private_key.pem").read())
) as g_client:
res = g_client.checkout_sessions.create(checkout_session_create=models.CheckoutSessionCreate(
cart_items=[
models.CartItem(
name="GoPro HD",
quantity=2,
unit_amount=1299,
discount_amount=0,
tax_amount=0,
external_identifier="goprohd",
sku="GPHD1078",
product_url="https://example.com/catalog/go-pro-hd",
image_url="https://example.com/images/go-pro-hd.jpg",
categories=[
"camera",
"travel",
"gear",
],
product_type="physical",
seller_country="GB",
),
models.CartItem(
name="GoPro HD",
quantity=2,
unit_amount=1299,
discount_amount=0,
tax_amount=0,
external_identifier="goprohd",
sku="GPHD1078",
product_url="https://example.com/catalog/go-pro-hd",
image_url="https://example.com/images/go-pro-hd.jpg",
categories=[
"camera",
"travel",
"gear",
],
product_type="physical",
seller_country="GB",
),
models.CartItem(
name="GoPro HD",
quantity=2,
unit_amount=1299,
discount_amount=0,
tax_amount=0,
external_identifier="goprohd",
sku="GPHD1078",
product_url="https://example.com/catalog/go-pro-hd",
image_url="https://example.com/images/go-pro-hd.jpg",
categories=[
"camera",
"travel",
"gear",
],
product_type="physical",
seller_country="GB",
),
],
metadata={
"cohort": "cohort-a",
"order_id": "order-12345",
},
buyer=models.GuestBuyer(
display_name="John Doe",
external_identifier="buyer-12345",
billing_details=models.BillingDetails(
first_name="John",
last_name="Doe",
email_address="john@example.com",
phone_number="+1234567890",
address=models.Address(
city="San Jose",
country="US",
postal_code="94560",
state="California",
state_code="US-CA",
house_number_or_name="10",
line1="Stafford Appartments",
line2="29th Street",
organization="Gr4vy",
),
tax_id=models.TaxID(
value="12345678931",
kind="ar.cuit",
),
),
shipping_details=models.ShippingDetailsCreate(
first_name="John",
last_name="Doe",
email_address="john@example.com",
phone_number="+1234567890",
address=models.Address(
city="San Jose",
country="US",
postal_code="94560",
state="California",
state_code="US-CA",
house_number_or_name="10",
line1="Stafford Appartments",
line2="29th Street",
organization="Gr4vy",
),
),
),
airline=models.Airline(
booking_code="X36Q9C",
is_cardholder_traveling=True,
issued_address="123 Broadway, New York",
issued_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
issuing_carrier_code="649",
issuing_carrier_name="Air Transat A.T. Inc",
issuing_iata_designator="TS",
issuing_icao_code="TSC",
legs=[
models.AirlineLeg(
arrival_airport="LAX",
arrival_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
arrival_city="Los Angeles",
arrival_country="US",
carrier_code="649",
carrier_name="Air Transat A.T. Inc",
iata_designator="TS",
icao_code="TSC",
coupon_number="15885566",
departure_airport="LHR",
departure_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
departure_city="London",
departure_country="GB",
departure_tax_amount=1200,
fare_amount=129900,
fare_basis_code="FY",
fee_amount=1200,
flight_class="E",
flight_number="101",
route_type="round_trip",
seat_class="F",
stop_over=False,
tax_amount=1200,
),
models.AirlineLeg(
arrival_airport="LAX",
arrival_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
arrival_city="Los Angeles",
arrival_country="US",
carrier_code="649",
carrier_name="Air Transat A.T. Inc",
iata_designator="TS",
icao_code="TSC",
coupon_number="15885566",
departure_airport="LHR",
departure_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
departure_city="London",
departure_country="GB",
departure_tax_amount=1200,
fare_amount=129900,
fare_basis_code="FY",
fee_amount=1200,
flight_class="E",
flight_number="101",
route_type="round_trip",
seat_class="F",
stop_over=False,
tax_amount=1200,
),
models.AirlineLeg(
arrival_airport="LAX",
arrival_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
arrival_city="Los Angeles",
arrival_country="US",
carrier_code="649",
carrier_name="Air Transat A.T. Inc",
iata_designator="TS",
icao_code="TSC",
coupon_number="15885566",
departure_airport="LHR",
departure_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
departure_city="London",
departure_country="GB",
departure_tax_amount=1200,
fare_amount=129900,
fare_basis_code="FY",
fee_amount=1200,
flight_class="E",
flight_number="101",
route_type="round_trip",
seat_class="F",
stop_over=False,
tax_amount=1200,
),
],
passenger_name_record="JOHN L",
passengers=[
models.AirlinePassenger(
age_group="adult",
date_of_birth=date.fromisoformat("2013-07-16"),
email_address="john@example.com",
first_name="John",
frequent_flyer_number="15885566",
last_name="Luhn",
passport_number="11117700225",
phone_number="+1234567890",
ticket_number="BA1236699999",
title="Mr.",
country_code="US",
),
models.AirlinePassenger(
age_group="adult",
date_of_birth=date.fromisoformat("2013-07-16"),
email_address="john@example.com",
first_name="John",
frequent_flyer_number="15885566",
last_name="Luhn",
passport_number="11117700225",
phone_number="+1234567890",
ticket_number="BA1236699999",
title="Mr.",
country_code="US",
),
],
reservation_system="Amadeus",
restricted_ticket=False,
ticket_delivery_method="electronic",
ticket_number="123-1234-151555",
travel_agency_code="12345",
travel_agency_invoice_number="EG15555155",
travel_agency_name="ACME Agency",
travel_agency_plan_name="B733",
),
))
# Handle response
print(res)import { Gr4vy, withToken } from "@gr4vy/sdk";
import fs from "fs";
const gr4vy = new Gr4vy({
id: "example",
server: "sandbox",
merchantAccountId: "default",
bearerAuth: withToken({
privateKey: fs.readFileSync("private_key.pem", "utf8"),
}),
});
async function run() {
const result = await gr4vy.checkoutSessions.create();
console.log(result);
}
run();curl --request POST \
--url https://api.sandbox.{id}.gr4vy.app/checkout/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"id": "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
"expires_at": "2013-07-16T19:23:00.000+00:00",
"cart_items": [
{
"name": "GoPro HD",
"quantity": 2,
"unit_amount": 1299,
"discount_amount": 0,
"tax_amount": 0,
"external_identifier": "goprohd",
"sku": "GPHD1078",
"upc": "012345678905",
"product_url": "https://example.com/catalog/go-pro-hd",
"image_url": "https://example.com/images/go-pro-hd.jpg",
"categories": [
"camera",
"travel",
"gear"
],
"subcategories": [
"action-cameras"
],
"brand": "GoPro",
"product_type": "physical",
"seller_country": "US",
"tax_exempt": false,
"unit_of_measure": "feet",
"commodity_code": "43211503",
"description": "A brief description of an interesting item.",
"duty_amount": 1299,
"shipping_amount": 1299
}
],
"metadata": {
"cohort": "cohort-a",
"order_id": "order-12345"
},
"buyer": {
"display_name": "John Doe",
"external_identifier": "buyer-12345",
"billing_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "Gr4vy"
},
"tax_id": {
"value": "12345678931",
"kind": "us.ein"
}
},
"account_number": "<string>",
"shipping_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "Gr4vy"
}
}
},
"airline": {
"booking_code": "X36Q9C",
"is_cardholder_traveling": true,
"issued_address": "123 Broadway, New York",
"issued_at": "2013-07-16T19:23:00.000+00:00",
"issuing_carrier_code": "649",
"issuing_carrier_name": "Air Transat A.T. Inc",
"issuing_iata_designator": "TS",
"issuing_icao_code": "TSC",
"legs": [
{
"arrival_airport": "LAX",
"arrival_at": "2013-07-16T19:23:00.000+00:00",
"arrival_city": "Los Angeles",
"arrival_country": "US",
"carrier_code": "649",
"carrier_name": "Air Transat A.T. Inc",
"iata_designator": "TS",
"icao_code": "TSC",
"coupon_number": "15885566",
"departure_airport": "LHR",
"departure_at": "2013-07-16T19:23:00.000+00:00",
"departure_city": "London",
"departure_country": "GB",
"departure_tax_amount": 1200,
"fare_amount": 129900,
"fare_basis_code": "FY",
"fee_amount": 1200,
"flight_class": "E",
"flight_number": "101",
"route_type": "round_trip",
"seat_class": "F",
"stop_over": false,
"tax_amount": 1200
}
],
"passenger_name_record": "JOHN L",
"passengers": [
{
"age_group": "adult",
"date_of_birth": "2013-07-16",
"email_address": "john@example.com",
"first_name": "John",
"frequent_flyer_number": "15885566",
"last_name": "Luhn",
"passport_number": "11117700225",
"phone_number": "+1234567890",
"ticket_number": "BA1236699999",
"title": "Mr.",
"country_code": "US"
}
],
"reservation_system": "Amadeus",
"restricted_ticket": false,
"ticket_delivery_method": "electronic",
"ticket_number": "123-1234-151555",
"travel_agency_code": "12345",
"travel_agency_invoice_number": "EG15555155",
"travel_agency_name": "ACME Agency",
"travel_agency_plan_name": "B733"
},
"type": "checkout-session",
"payment_method": {
"type": "payment-method",
"id": "ef9496d8-53a5-4aad-8ca2-00eb68334389",
"details": {
"bin": "411111",
"card_country": "US",
"card_type": "credit",
"card_issuer_name": "Bank of America NA"
},
"label": "1234",
"method": "card",
"scheme": "visa",
"fingerprint": "a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4"
}
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Request failed validation",
"details": [],
"resource_id": "cdc70639-cb9c-4222-a73f-b8ce39f7821b"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"details": []
}Create checkout session
Create a new checkout session.
POST
/
checkout
/
sessions
C#
using Gr4vy;
using Gr4vy.Models.Components;
using NodaTime;
using System;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
id: "example",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.CheckoutSessions.CreateAsync(checkoutSessionCreate: new CheckoutSessionCreate() {
CartItems = new List<CartItem>() {
new CartItem() {
Name = "GoPro HD",
Quantity = 2,
UnitAmount = 1299,
DiscountAmount = 0,
TaxAmount = 0,
ExternalIdentifier = "goprohd",
Sku = "GPHD1078",
ProductUrl = "https://example.com/catalog/go-pro-hd",
ImageUrl = "https://example.com/images/go-pro-hd.jpg",
Categories = new List<string>() {
"camera",
"travel",
"gear",
},
ProductType = ProductType.Physical,
SellerCountry = "GB",
},
new CartItem() {
Name = "GoPro HD",
Quantity = 2,
UnitAmount = 1299,
DiscountAmount = 0,
TaxAmount = 0,
ExternalIdentifier = "goprohd",
Sku = "GPHD1078",
ProductUrl = "https://example.com/catalog/go-pro-hd",
ImageUrl = "https://example.com/images/go-pro-hd.jpg",
Categories = new List<string>() {
"camera",
"travel",
"gear",
},
ProductType = ProductType.Physical,
SellerCountry = "GB",
},
new CartItem() {
Name = "GoPro HD",
Quantity = 2,
UnitAmount = 1299,
DiscountAmount = 0,
TaxAmount = 0,
ExternalIdentifier = "goprohd",
Sku = "GPHD1078",
ProductUrl = "https://example.com/catalog/go-pro-hd",
ImageUrl = "https://example.com/images/go-pro-hd.jpg",
Categories = new List<string>() {
"camera",
"travel",
"gear",
},
ProductType = ProductType.Physical,
SellerCountry = "US",
},
},
Metadata = new Dictionary<string, string>() {
{ "cohort", "cohort-a" },
{ "order_id", "order-12345" },
},
Buyer = new GuestBuyer() {
DisplayName = "John Doe",
ExternalIdentifier = "buyer-12345",
BillingDetails = new BillingDetails() {
FirstName = "John",
LastName = "Doe",
EmailAddress = "john@example.com",
PhoneNumber = "+1234567890",
Address = new Address() {
City = "San Jose",
Country = "US",
PostalCode = "94560",
State = "California",
StateCode = "US-CA",
HouseNumberOrName = "10",
Line1 = "Stafford Appartments",
Line2 = "29th Street",
Organization = "Gr4vy",
},
TaxId = new TaxId() {
Value = "12345678931",
Kind = TaxIdKind.ArCuit,
},
},
ShippingDetails = new ShippingDetailsCreate() {
FirstName = "John",
LastName = "Doe",
EmailAddress = "john@example.com",
PhoneNumber = "+1234567890",
Address = new Address() {
City = "San Jose",
Country = "US",
PostalCode = "94560",
State = "California",
StateCode = "US-CA",
HouseNumberOrName = "10",
Line1 = "Stafford Appartments",
Line2 = "29th Street",
Organization = "Gr4vy",
},
},
},
Airline = new Airline() {
BookingCode = "X36Q9C",
IsCardholderTraveling = true,
IssuedAddress = "123 Broadway, New York",
IssuedAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
IssuingCarrierCode = "649",
IssuingCarrierName = "Air Transat A.T. Inc",
IssuingIataDesignator = "TS",
IssuingIcaoCode = "TSC",
Legs = new List<AirlineLeg>() {
new AirlineLeg() {
ArrivalAirport = "LAX",
ArrivalAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
ArrivalCity = "Los Angeles",
ArrivalCountry = "US",
CarrierCode = "649",
CarrierName = "Air Transat A.T. Inc",
IataDesignator = "TS",
IcaoCode = "TSC",
CouponNumber = "15885566",
DepartureAirport = "LHR",
DepartureAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
DepartureCity = "London",
DepartureCountry = "GB",
DepartureTaxAmount = 1200,
FareAmount = 129900,
FareBasisCode = "FY",
FeeAmount = 1200,
FlightClass = "E",
FlightNumber = "101",
RouteType = RouteType.RoundTrip,
SeatClass = "F",
StopOver = false,
TaxAmount = 1200,
},
new AirlineLeg() {
ArrivalAirport = "LAX",
ArrivalAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
ArrivalCity = "Los Angeles",
ArrivalCountry = "US",
CarrierCode = "649",
CarrierName = "Air Transat A.T. Inc",
IataDesignator = "TS",
IcaoCode = "TSC",
CouponNumber = "15885566",
DepartureAirport = "LHR",
DepartureAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
DepartureCity = "London",
DepartureCountry = "GB",
DepartureTaxAmount = 1200,
FareAmount = 129900,
FareBasisCode = "FY",
FeeAmount = 1200,
FlightClass = "E",
FlightNumber = "101",
RouteType = RouteType.RoundTrip,
SeatClass = "F",
StopOver = false,
TaxAmount = 1200,
},
new AirlineLeg() {
ArrivalAirport = "LAX",
ArrivalAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
ArrivalCity = "Los Angeles",
ArrivalCountry = "US",
CarrierCode = "649",
CarrierName = "Air Transat A.T. Inc",
IataDesignator = "TS",
IcaoCode = "TSC",
CouponNumber = "15885566",
DepartureAirport = "LHR",
DepartureAt = System.DateTime.Parse("2013-07-16T19:23:00.000+00:00").ToUniversalTime(),
DepartureCity = "London",
DepartureCountry = "GB",
DepartureTaxAmount = 1200,
FareAmount = 129900,
FareBasisCode = "FY",
FeeAmount = 1200,
FlightClass = "E",
FlightNumber = "101",
RouteType = RouteType.RoundTrip,
SeatClass = "F",
StopOver = false,
TaxAmount = 1200,
},
},
PassengerNameRecord = "JOHN L",
Passengers = new List<AirlinePassenger>() {
new AirlinePassenger() {
AgeGroup = AgeGroup.Adult,
DateOfBirth = LocalDate.FromDateTime(System.DateTime.Parse("2013-07-16")),
EmailAddress = "john@example.com",
FirstName = "John",
FrequentFlyerNumber = "15885566",
LastName = "Luhn",
PassportNumber = "11117700225",
PhoneNumber = "+1234567890",
TicketNumber = "BA1236699999",
Title = "Mr.",
CountryCode = "US",
},
new AirlinePassenger() {
AgeGroup = AgeGroup.Adult,
DateOfBirth = LocalDate.FromDateTime(System.DateTime.Parse("2013-07-16")),
EmailAddress = "john@example.com",
FirstName = "John",
FrequentFlyerNumber = "15885566",
LastName = "Luhn",
PassportNumber = "11117700225",
PhoneNumber = "+1234567890",
TicketNumber = "BA1236699999",
Title = "Mr.",
CountryCode = "US",
},
},
ReservationSystem = "Amadeus",
RestrictedTicket = false,
TicketDeliveryMethod = TicketDeliveryMethod.Electronic,
TicketNumber = "123-1234-151555",
TravelAgencyCode = "12345",
TravelAgencyInvoiceNumber = "EG15555155",
TravelAgencyName = "ACME Agency",
TravelAgencyPlanName = "B733",
},
});
// handle responsepackage main
import(
"context"
"os"
gr4vygo "github.com/gr4vy/gr4vy-go"
"github.com/gr4vy/gr4vy-go/models/components"
"github.com/gr4vy/gr4vy-go/types"
"log"
)
func main() {
ctx := context.Background()
s := gr4vygo.New(
gr4vygo.WithMerchantAccountID("default"),
gr4vygo.WithSecurity(os.Getenv("GR4VY_BEARER_AUTH")),
)
res, err := s.CheckoutSessions.Create(ctx, nil, &components.CheckoutSessionCreate{
CartItems: []components.CartItem{
components.CartItem{
Name: "GoPro HD",
Quantity: 2,
UnitAmount: 1299,
DiscountAmount: gr4vygo.Pointer[int64](0),
TaxAmount: gr4vygo.Pointer[int64](0),
ExternalIdentifier: gr4vygo.Pointer("goprohd"),
Sku: gr4vygo.Pointer("GPHD1078"),
ProductURL: gr4vygo.Pointer("https://example.com/catalog/go-pro-hd"),
ImageURL: gr4vygo.Pointer("https://example.com/images/go-pro-hd.jpg"),
Categories: []string{
"camera",
"travel",
"gear",
},
ProductType: components.ProductTypePhysical.ToPointer(),
SellerCountry: gr4vygo.Pointer("US"),
},
components.CartItem{
Name: "GoPro HD",
Quantity: 2,
UnitAmount: 1299,
DiscountAmount: gr4vygo.Pointer[int64](0),
TaxAmount: gr4vygo.Pointer[int64](0),
ExternalIdentifier: gr4vygo.Pointer("goprohd"),
Sku: gr4vygo.Pointer("GPHD1078"),
ProductURL: gr4vygo.Pointer("https://example.com/catalog/go-pro-hd"),
ImageURL: gr4vygo.Pointer("https://example.com/images/go-pro-hd.jpg"),
Categories: []string{
"camera",
"travel",
"gear",
},
ProductType: components.ProductTypePhysical.ToPointer(),
SellerCountry: gr4vygo.Pointer("US"),
},
},
Metadata: map[string]string{
"cohort": "cohort-a",
"order_id": "order-12345",
},
Buyer: nil,
Airline: &components.Airline{
BookingCode: gr4vygo.Pointer("X36Q9C"),
IsCardholderTraveling: gr4vygo.Pointer(true),
IssuedAddress: gr4vygo.Pointer("123 Broadway, New York"),
IssuedAt: types.MustNewTimeFromString("2013-07-16T19:23:00.000+00:00"),
IssuingCarrierCode: gr4vygo.Pointer("649"),
IssuingCarrierName: gr4vygo.Pointer("Air Transat A.T. Inc"),
IssuingIataDesignator: gr4vygo.Pointer("TS"),
IssuingIcaoCode: gr4vygo.Pointer("TSC"),
Legs: []components.AirlineLeg{
components.AirlineLeg{
ArrivalAirport: gr4vygo.Pointer("LAX"),
ArrivalAt: types.MustNewTimeFromString("2013-07-16T19:23:00.000+00:00"),
ArrivalCity: gr4vygo.Pointer("Los Angeles"),
ArrivalCountry: gr4vygo.Pointer("US"),
CarrierCode: gr4vygo.Pointer("649"),
CarrierName: gr4vygo.Pointer("Air Transat A.T. Inc"),
IataDesignator: gr4vygo.Pointer("TS"),
IcaoCode: gr4vygo.Pointer("TSC"),
CouponNumber: gr4vygo.Pointer("15885566"),
DepartureAirport: gr4vygo.Pointer("LHR"),
DepartureAt: types.MustNewTimeFromString("2013-07-16T19:23:00.000+00:00"),
DepartureCity: gr4vygo.Pointer("London"),
DepartureCountry: gr4vygo.Pointer("GB"),
DepartureTaxAmount: gr4vygo.Pointer[int64](1200),
FareAmount: gr4vygo.Pointer[int64](129900),
FareBasisCode: gr4vygo.Pointer("FY"),
FeeAmount: gr4vygo.Pointer[int64](1200),
FlightClass: gr4vygo.Pointer("E"),
FlightNumber: gr4vygo.Pointer("101"),
RouteType: components.RouteTypeRoundTrip.ToPointer(),
SeatClass: gr4vygo.Pointer("F"),
StopOver: gr4vygo.Pointer(false),
TaxAmount: gr4vygo.Pointer[int64](1200),
},
},
PassengerNameRecord: gr4vygo.Pointer("JOHN L"),
Passengers: []components.AirlinePassenger{
components.AirlinePassenger{
AgeGroup: components.AgeGroupAdult.ToPointer(),
DateOfBirth: types.MustNewDateFromString("2013-07-16"),
EmailAddress: gr4vygo.Pointer("john@example.com"),
FirstName: gr4vygo.Pointer("John"),
FrequentFlyerNumber: gr4vygo.Pointer("15885566"),
LastName: gr4vygo.Pointer("Luhn"),
PassportNumber: gr4vygo.Pointer("11117700225"),
PhoneNumber: gr4vygo.Pointer("+1234567890"),
TicketNumber: gr4vygo.Pointer("BA1236699999"),
Title: gr4vygo.Pointer("Mr."),
CountryCode: gr4vygo.Pointer("US"),
},
components.AirlinePassenger{
AgeGroup: components.AgeGroupAdult.ToPointer(),
DateOfBirth: types.MustNewDateFromString("2013-07-16"),
EmailAddress: gr4vygo.Pointer("john@example.com"),
FirstName: gr4vygo.Pointer("John"),
FrequentFlyerNumber: gr4vygo.Pointer("15885566"),
LastName: gr4vygo.Pointer("Luhn"),
PassportNumber: gr4vygo.Pointer("11117700225"),
PhoneNumber: gr4vygo.Pointer("+1234567890"),
TicketNumber: gr4vygo.Pointer("BA1236699999"),
Title: gr4vygo.Pointer("Mr."),
CountryCode: gr4vygo.Pointer("US"),
},
},
ReservationSystem: gr4vygo.Pointer("Amadeus"),
RestrictedTicket: gr4vygo.Pointer(false),
TicketDeliveryMethod: components.TicketDeliveryMethodElectronic.ToPointer(),
TicketNumber: gr4vygo.Pointer("123-1234-151555"),
TravelAgencyCode: gr4vygo.Pointer("12345"),
TravelAgencyInvoiceNumber: gr4vygo.Pointer("EG15555155"),
TravelAgencyName: gr4vygo.Pointer("ACME Agency"),
TravelAgencyPlanName: gr4vygo.Pointer("B733"),
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}package hello.world;
import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.*;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.CreateCheckoutSessionResponse;
import java.lang.Exception;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
public class Application {
public static void main(String[] args) throws Exception {
Gr4vy sdk = Gr4vy.builder()
.merchantAccountId("default")
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
CreateCheckoutSessionResponse res = sdk.checkoutSessions().create()
.checkoutSessionCreate(CheckoutSessionCreate.builder()
.cartItems(List.of(
CartItem.builder()
.name("GoPro HD")
.quantity(2L)
.unitAmount(1299L)
.discountAmount(0L)
.taxAmount(0L)
.externalIdentifier("goprohd")
.sku("GPHD1078")
.productUrl("https://example.com/catalog/go-pro-hd")
.imageUrl("https://example.com/images/go-pro-hd.jpg")
.categories(List.of(
"camera",
"travel",
"gear"))
.productType(ProductType.PHYSICAL)
.sellerCountry("US")
.build(),
CartItem.builder()
.name("GoPro HD")
.quantity(2L)
.unitAmount(1299L)
.discountAmount(0L)
.taxAmount(0L)
.externalIdentifier("goprohd")
.sku("GPHD1078")
.productUrl("https://example.com/catalog/go-pro-hd")
.imageUrl("https://example.com/images/go-pro-hd.jpg")
.categories(List.of(
"camera",
"travel",
"gear"))
.productType(ProductType.PHYSICAL)
.sellerCountry("US")
.build()))
.metadata(Map.ofEntries(
Map.entry("cohort", "cohort-a"),
Map.entry("order_id", "order-12345")))
.buyer(JsonNullable.of(null))
.airline(Airline.builder()
.bookingCode("X36Q9C")
.isCardholderTraveling(true)
.issuedAddress("123 Broadway, New York")
.issuedAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00"))
.issuingCarrierCode("649")
.issuingCarrierName("Air Transat A.T. Inc")
.issuingIataDesignator("TS")
.issuingIcaoCode("TSC")
.legs(List.of(
AirlineLeg.builder()
.arrivalAirport("LAX")
.arrivalAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00"))
.arrivalCity("Los Angeles")
.arrivalCountry("US")
.carrierCode("649")
.carrierName("Air Transat A.T. Inc")
.iataDesignator("TS")
.icaoCode("TSC")
.couponNumber("15885566")
.departureAirport("LHR")
.departureAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00"))
.departureCity("London")
.departureCountry("GB")
.departureTaxAmount(1200L)
.fareAmount(129900L)
.fareBasisCode("FY")
.feeAmount(1200L)
.flightClass("E")
.flightNumber("101")
.routeType(RouteType.ROUND_TRIP)
.seatClass("F")
.stopOver(false)
.taxAmount(1200L)
.build()))
.passengerNameRecord("JOHN L")
.passengers(List.of(
AirlinePassenger.builder()
.ageGroup(AgeGroup.ADULT)
.dateOfBirth(LocalDate.parse("2013-07-16"))
.emailAddress("john@example.com")
.firstName("John")
.frequentFlyerNumber("15885566")
.lastName("Luhn")
.passportNumber("11117700225")
.phoneNumber("+1234567890")
.ticketNumber("BA1236699999")
.title("Mr.")
.countryCode("US")
.build(),
AirlinePassenger.builder()
.ageGroup(AgeGroup.ADULT)
.dateOfBirth(LocalDate.parse("2013-07-16"))
.emailAddress("john@example.com")
.firstName("John")
.frequentFlyerNumber("15885566")
.lastName("Luhn")
.passportNumber("11117700225")
.phoneNumber("+1234567890")
.ticketNumber("BA1236699999")
.title("Mr.")
.countryCode("US")
.build()))
.reservationSystem("Amadeus")
.restrictedTicket(false)
.ticketDeliveryMethod(TicketDeliveryMethod.ELECTRONIC)
.ticketNumber("123-1234-151555")
.travelAgencyCode("12345")
.travelAgencyInvoiceNumber("EG15555155")
.travelAgencyName("ACME Agency")
.travelAgencyPlanName("B733")
.build())
.build())
.call();
if (res.checkoutSession().isPresent()) {
System.out.println(res.checkoutSession().get());
}
}
}declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\DateTime\LocalDate;
use Gr4vy;
use Gr4vy\Utils;
$sdk = Gr4vy\SDK::builder()
->setId('example')
->setServer('sandbox')
->setSecuritySource(Auth::withToken($privateKey))
->setMerchantAccountId('default')
->build();
$checkoutSessionCreate = new Gr4vy\CheckoutSessionCreate(
cartItems: [
new Gr4vy\CartItem(
name: 'GoPro HD',
quantity: 2,
unitAmount: 1299,
discountAmount: 0,
taxAmount: 0,
externalIdentifier: 'goprohd',
sku: 'GPHD1078',
productUrl: 'https://example.com/catalog/go-pro-hd',
imageUrl: 'https://example.com/images/go-pro-hd.jpg',
categories: [
'camera',
'travel',
'gear',
],
productType: 'physical',
sellerCountry: 'US',
),
new Gr4vy\CartItem(
name: 'GoPro HD',
quantity: 2,
unitAmount: 1299,
discountAmount: 0,
taxAmount: 0,
externalIdentifier: 'goprohd',
sku: 'GPHD1078',
productUrl: 'https://example.com/catalog/go-pro-hd',
imageUrl: 'https://example.com/images/go-pro-hd.jpg',
categories: [
'camera',
'travel',
'gear',
],
productType: 'physical',
sellerCountry: 'US',
),
],
metadata: [
'cohort' => 'cohort-a',
'order_id' => 'order-12345',
],
buyer: new Gr4vy\GuestBuyer(
displayName: 'John Doe',
externalIdentifier: 'buyer-12345',
billingDetails: new Gr4vy\BillingDetails(
firstName: 'John',
lastName: 'Doe',
emailAddress: 'john@example.com',
phoneNumber: '+1234567890',
address: new Gr4vy\Address(
city: 'San Jose',
country: 'US',
postalCode: '94560',
state: 'California',
stateCode: 'US-CA',
houseNumberOrName: '10',
line1: 'Stafford Appartments',
line2: '29th Street',
organization: 'Gr4vy',
),
taxId: new Gr4vy\TaxId(
value: '12345678931',
kind: 'my.frp',
),
),
shippingDetails: new Gr4vy\ShippingDetailsCreate(
firstName: 'John',
lastName: 'Doe',
emailAddress: 'john@example.com',
phoneNumber: '+1234567890',
address: null,
),
),
airline: new Gr4vy\Airline(
bookingCode: 'X36Q9C',
isCardholderTraveling: true,
issuedAddress: '123 Broadway, New York',
issuedAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
issuingCarrierCode: '649',
issuingCarrierName: 'Air Transat A.T. Inc',
issuingIataDesignator: 'TS',
issuingIcaoCode: 'TSC',
legs: [
new Gr4vy\AirlineLeg(
arrivalAirport: 'LAX',
arrivalAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
arrivalCity: 'Los Angeles',
arrivalCountry: 'US',
carrierCode: '649',
carrierName: 'Air Transat A.T. Inc',
iataDesignator: 'TS',
icaoCode: 'TSC',
couponNumber: '15885566',
departureAirport: 'LHR',
departureAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
departureCity: 'London',
departureCountry: 'GB',
departureTaxAmount: 1200,
fareAmount: 129900,
fareBasisCode: 'FY',
feeAmount: 1200,
flightClass: 'E',
flightNumber: '101',
routeType: 'round_trip',
seatClass: 'F',
stopOver: false,
taxAmount: 1200,
),
new Gr4vy\AirlineLeg(
arrivalAirport: 'LAX',
arrivalAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
arrivalCity: 'Los Angeles',
arrivalCountry: 'US',
carrierCode: '649',
carrierName: 'Air Transat A.T. Inc',
iataDesignator: 'TS',
icaoCode: 'TSC',
couponNumber: '15885566',
departureAirport: 'LHR',
departureAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
departureCity: 'London',
departureCountry: 'GB',
departureTaxAmount: 1200,
fareAmount: 129900,
fareBasisCode: 'FY',
feeAmount: 1200,
flightClass: 'E',
flightNumber: '101',
routeType: 'round_trip',
seatClass: 'F',
stopOver: false,
taxAmount: 1200,
),
new Gr4vy\AirlineLeg(
arrivalAirport: 'LAX',
arrivalAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
arrivalCity: 'Los Angeles',
arrivalCountry: 'US',
carrierCode: '649',
carrierName: 'Air Transat A.T. Inc',
iataDesignator: 'TS',
icaoCode: 'TSC',
couponNumber: '15885566',
departureAirport: 'LHR',
departureAt: Utils\Utils::parseDateTime('2013-07-16T19:23:00.000+00:00'),
departureCity: 'London',
departureCountry: 'GB',
departureTaxAmount: 1200,
fareAmount: 129900,
fareBasisCode: 'FY',
feeAmount: 1200,
flightClass: 'E',
flightNumber: '101',
routeType: 'round_trip',
seatClass: 'F',
stopOver: false,
taxAmount: 1200,
),
],
passengerNameRecord: 'JOHN L',
passengers: [
new Gr4vy\AirlinePassenger(
ageGroup: 'adult',
dateOfBirth: LocalDate::parse('2013-07-16'),
emailAddress: 'john@example.com',
firstName: 'John',
frequentFlyerNumber: '15885566',
lastName: 'Luhn',
passportNumber: '11117700225',
phoneNumber: '+1234567890',
ticketNumber: 'BA1236699999',
title: 'Mr.',
countryCode: 'US',
),
new Gr4vy\AirlinePassenger(
ageGroup: 'adult',
dateOfBirth: LocalDate::parse('2013-07-16'),
emailAddress: 'john@example.com',
firstName: 'John',
frequentFlyerNumber: '15885566',
lastName: 'Luhn',
passportNumber: '11117700225',
phoneNumber: '+1234567890',
ticketNumber: 'BA1236699999',
title: 'Mr.',
countryCode: 'US',
),
],
reservationSystem: 'Amadeus',
restrictedTicket: false,
ticketDeliveryMethod: 'electronic',
ticketNumber: '123-1234-151555',
travelAgencyCode: '12345',
travelAgencyInvoiceNumber: 'EG15555155',
travelAgencyName: 'ACME Agency',
travelAgencyPlanName: 'B733',
),
);
$response = $sdk->checkoutSessions->create(
checkoutSessionCreate: $checkoutSessionCreate
);
if ($response->checkoutSession !== null) {
// handle response
}from datetime import date
from gr4vy import Gr4vy, models
from gr4vy.utils import parse_datetime
import os
with Gr4vy(
id="example",
server="sandbox",
merchant_account_id="default",
bearer_auth=auth.with_token(open("./private_key.pem").read())
) as g_client:
res = g_client.checkout_sessions.create(checkout_session_create=models.CheckoutSessionCreate(
cart_items=[
models.CartItem(
name="GoPro HD",
quantity=2,
unit_amount=1299,
discount_amount=0,
tax_amount=0,
external_identifier="goprohd",
sku="GPHD1078",
product_url="https://example.com/catalog/go-pro-hd",
image_url="https://example.com/images/go-pro-hd.jpg",
categories=[
"camera",
"travel",
"gear",
],
product_type="physical",
seller_country="GB",
),
models.CartItem(
name="GoPro HD",
quantity=2,
unit_amount=1299,
discount_amount=0,
tax_amount=0,
external_identifier="goprohd",
sku="GPHD1078",
product_url="https://example.com/catalog/go-pro-hd",
image_url="https://example.com/images/go-pro-hd.jpg",
categories=[
"camera",
"travel",
"gear",
],
product_type="physical",
seller_country="GB",
),
models.CartItem(
name="GoPro HD",
quantity=2,
unit_amount=1299,
discount_amount=0,
tax_amount=0,
external_identifier="goprohd",
sku="GPHD1078",
product_url="https://example.com/catalog/go-pro-hd",
image_url="https://example.com/images/go-pro-hd.jpg",
categories=[
"camera",
"travel",
"gear",
],
product_type="physical",
seller_country="GB",
),
],
metadata={
"cohort": "cohort-a",
"order_id": "order-12345",
},
buyer=models.GuestBuyer(
display_name="John Doe",
external_identifier="buyer-12345",
billing_details=models.BillingDetails(
first_name="John",
last_name="Doe",
email_address="john@example.com",
phone_number="+1234567890",
address=models.Address(
city="San Jose",
country="US",
postal_code="94560",
state="California",
state_code="US-CA",
house_number_or_name="10",
line1="Stafford Appartments",
line2="29th Street",
organization="Gr4vy",
),
tax_id=models.TaxID(
value="12345678931",
kind="ar.cuit",
),
),
shipping_details=models.ShippingDetailsCreate(
first_name="John",
last_name="Doe",
email_address="john@example.com",
phone_number="+1234567890",
address=models.Address(
city="San Jose",
country="US",
postal_code="94560",
state="California",
state_code="US-CA",
house_number_or_name="10",
line1="Stafford Appartments",
line2="29th Street",
organization="Gr4vy",
),
),
),
airline=models.Airline(
booking_code="X36Q9C",
is_cardholder_traveling=True,
issued_address="123 Broadway, New York",
issued_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
issuing_carrier_code="649",
issuing_carrier_name="Air Transat A.T. Inc",
issuing_iata_designator="TS",
issuing_icao_code="TSC",
legs=[
models.AirlineLeg(
arrival_airport="LAX",
arrival_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
arrival_city="Los Angeles",
arrival_country="US",
carrier_code="649",
carrier_name="Air Transat A.T. Inc",
iata_designator="TS",
icao_code="TSC",
coupon_number="15885566",
departure_airport="LHR",
departure_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
departure_city="London",
departure_country="GB",
departure_tax_amount=1200,
fare_amount=129900,
fare_basis_code="FY",
fee_amount=1200,
flight_class="E",
flight_number="101",
route_type="round_trip",
seat_class="F",
stop_over=False,
tax_amount=1200,
),
models.AirlineLeg(
arrival_airport="LAX",
arrival_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
arrival_city="Los Angeles",
arrival_country="US",
carrier_code="649",
carrier_name="Air Transat A.T. Inc",
iata_designator="TS",
icao_code="TSC",
coupon_number="15885566",
departure_airport="LHR",
departure_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
departure_city="London",
departure_country="GB",
departure_tax_amount=1200,
fare_amount=129900,
fare_basis_code="FY",
fee_amount=1200,
flight_class="E",
flight_number="101",
route_type="round_trip",
seat_class="F",
stop_over=False,
tax_amount=1200,
),
models.AirlineLeg(
arrival_airport="LAX",
arrival_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
arrival_city="Los Angeles",
arrival_country="US",
carrier_code="649",
carrier_name="Air Transat A.T. Inc",
iata_designator="TS",
icao_code="TSC",
coupon_number="15885566",
departure_airport="LHR",
departure_at=parse_datetime("2013-07-16T19:23:00.000+00:00"),
departure_city="London",
departure_country="GB",
departure_tax_amount=1200,
fare_amount=129900,
fare_basis_code="FY",
fee_amount=1200,
flight_class="E",
flight_number="101",
route_type="round_trip",
seat_class="F",
stop_over=False,
tax_amount=1200,
),
],
passenger_name_record="JOHN L",
passengers=[
models.AirlinePassenger(
age_group="adult",
date_of_birth=date.fromisoformat("2013-07-16"),
email_address="john@example.com",
first_name="John",
frequent_flyer_number="15885566",
last_name="Luhn",
passport_number="11117700225",
phone_number="+1234567890",
ticket_number="BA1236699999",
title="Mr.",
country_code="US",
),
models.AirlinePassenger(
age_group="adult",
date_of_birth=date.fromisoformat("2013-07-16"),
email_address="john@example.com",
first_name="John",
frequent_flyer_number="15885566",
last_name="Luhn",
passport_number="11117700225",
phone_number="+1234567890",
ticket_number="BA1236699999",
title="Mr.",
country_code="US",
),
],
reservation_system="Amadeus",
restricted_ticket=False,
ticket_delivery_method="electronic",
ticket_number="123-1234-151555",
travel_agency_code="12345",
travel_agency_invoice_number="EG15555155",
travel_agency_name="ACME Agency",
travel_agency_plan_name="B733",
),
))
# Handle response
print(res)import { Gr4vy, withToken } from "@gr4vy/sdk";
import fs from "fs";
const gr4vy = new Gr4vy({
id: "example",
server: "sandbox",
merchantAccountId: "default",
bearerAuth: withToken({
privateKey: fs.readFileSync("private_key.pem", "utf8"),
}),
});
async function run() {
const result = await gr4vy.checkoutSessions.create();
console.log(result);
}
run();curl --request POST \
--url https://api.sandbox.{id}.gr4vy.app/checkout/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"id": "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
"expires_at": "2013-07-16T19:23:00.000+00:00",
"cart_items": [
{
"name": "GoPro HD",
"quantity": 2,
"unit_amount": 1299,
"discount_amount": 0,
"tax_amount": 0,
"external_identifier": "goprohd",
"sku": "GPHD1078",
"upc": "012345678905",
"product_url": "https://example.com/catalog/go-pro-hd",
"image_url": "https://example.com/images/go-pro-hd.jpg",
"categories": [
"camera",
"travel",
"gear"
],
"subcategories": [
"action-cameras"
],
"brand": "GoPro",
"product_type": "physical",
"seller_country": "US",
"tax_exempt": false,
"unit_of_measure": "feet",
"commodity_code": "43211503",
"description": "A brief description of an interesting item.",
"duty_amount": 1299,
"shipping_amount": 1299
}
],
"metadata": {
"cohort": "cohort-a",
"order_id": "order-12345"
},
"buyer": {
"display_name": "John Doe",
"external_identifier": "buyer-12345",
"billing_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "Gr4vy"
},
"tax_id": {
"value": "12345678931",
"kind": "us.ein"
}
},
"account_number": "<string>",
"shipping_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "Gr4vy"
}
}
},
"airline": {
"booking_code": "X36Q9C",
"is_cardholder_traveling": true,
"issued_address": "123 Broadway, New York",
"issued_at": "2013-07-16T19:23:00.000+00:00",
"issuing_carrier_code": "649",
"issuing_carrier_name": "Air Transat A.T. Inc",
"issuing_iata_designator": "TS",
"issuing_icao_code": "TSC",
"legs": [
{
"arrival_airport": "LAX",
"arrival_at": "2013-07-16T19:23:00.000+00:00",
"arrival_city": "Los Angeles",
"arrival_country": "US",
"carrier_code": "649",
"carrier_name": "Air Transat A.T. Inc",
"iata_designator": "TS",
"icao_code": "TSC",
"coupon_number": "15885566",
"departure_airport": "LHR",
"departure_at": "2013-07-16T19:23:00.000+00:00",
"departure_city": "London",
"departure_country": "GB",
"departure_tax_amount": 1200,
"fare_amount": 129900,
"fare_basis_code": "FY",
"fee_amount": 1200,
"flight_class": "E",
"flight_number": "101",
"route_type": "round_trip",
"seat_class": "F",
"stop_over": false,
"tax_amount": 1200
}
],
"passenger_name_record": "JOHN L",
"passengers": [
{
"age_group": "adult",
"date_of_birth": "2013-07-16",
"email_address": "john@example.com",
"first_name": "John",
"frequent_flyer_number": "15885566",
"last_name": "Luhn",
"passport_number": "11117700225",
"phone_number": "+1234567890",
"ticket_number": "BA1236699999",
"title": "Mr.",
"country_code": "US"
}
],
"reservation_system": "Amadeus",
"restricted_ticket": false,
"ticket_delivery_method": "electronic",
"ticket_number": "123-1234-151555",
"travel_agency_code": "12345",
"travel_agency_invoice_number": "EG15555155",
"travel_agency_name": "ACME Agency",
"travel_agency_plan_name": "B733"
},
"type": "checkout-session",
"payment_method": {
"type": "payment-method",
"id": "ef9496d8-53a5-4aad-8ca2-00eb68334389",
"details": {
"bin": "411111",
"card_country": "US",
"card_type": "credit",
"card_issuer_name": "Bank of America NA"
},
"label": "1234",
"method": "card",
"scheme": "visa",
"fingerprint": "a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4"
}
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Request failed validation",
"details": [],
"resource_id": "cdc70639-cb9c-4222-a73f-b8ce39f7821b"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Request failed validation",
"details": []
}{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"details": []
}This endpoint requires the
checkout-sessions.write scope.Authorizations
Headers
Body
application/json
Response
Successful Response