using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
id: "mattilda",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.CheckoutSessions.UpdateAsync(
sessionId: "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
checkoutSessionCreate: new CheckoutSessionCreate() {}
);
// handle response{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"cart_items": [
{
"name": "<string>",
"quantity": 123,
"unit_amount": 49999999,
"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": "US"
}
],
"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": "<string>",
"kind": "co.itin"
}
},
"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"
}
}
},
"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"
}
}Update the information stored on a checkout session.
using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
id: "mattilda",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.CheckoutSessions.UpdateAsync(
sessionId: "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
checkoutSessionCreate: new CheckoutSessionCreate() {}
);
// handle response{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"cart_items": [
{
"name": "<string>",
"quantity": 123,
"unit_amount": 49999999,
"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": "US"
}
],
"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": "<string>",
"kind": "co.itin"
}
},
"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"
}
}
},
"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"
}
}checkout-sessions.write scope.Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The ID of the merchant account to use for this request.
"default"
The ID of the checkout session.
"4137b1cf-39ac-42a8-bad6-1c680d5dab6b"
An array of cart items that represents the line items of a transaction.
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
{
"cohort": "cohort-a",
"order_id": "order-12345"
}Provide buyer details for the transaction. No buyer resource will be created on Gr4vy when used.
Show child attributes
3600 <= x <= 86400Successful Response
The ID for the checkout session.
"4137b1cf-39ac-42a8-bad6-1c680d5dab6b"
The date and time when this checkout session expires.
"2013-07-16T19:23:00.000+00:00"
An array of cart items that represents the line items of a transaction.
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
{
"cohort": "cohort-a",
"order_id": "order-12345"
}Provide buyer details for the transaction. No buyer resource will be created on Gr4vy when used.
Show child attributes
Always checkout-session
"checkout-session""checkout-session"
Information about the payment method stored on the checkout session.
Show child attributes
Was this page helpful?