using Gr4vy;
using Gr4vy.Models.Components;
using NodaTime;
using System;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
var checkoutSession = 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 = "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 = "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 = "physical",
SellerCountry = "US",
},
},
Metadata = new Dictionary<string, string>() {
{ "cohort", "cohort-a" },
{ "order_id", "order-12345" },
},
Buyer = new GuestBuyerInput() {
DisplayName = "John Doe",
ExternalIdentifier = "buyer-12345",
BillingDetails = new BillingDetailsInput() {
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 = "ar.cuit",
},
},
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",
},
},
},
});
// handle response