Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
06003fa
Created agentic/enroll endpoint
david-ruiz-cko Nov 17, 2025
408892c
JSONProperties added to match the snake name in the examples
david-ruiz-cko Nov 18, 2025
fc3d822
Clen the code and added JSONAtributes for the response
david-ruiz-cko Nov 18, 2025
3651a5f
Removed JSONAtribute, not needed, added OAuth scopem skipped integrat…
david-ruiz-cko Nov 18, 2025
cb99f05
new agentic createPurchaseIntent endpoint
david-ruiz-cko Nov 18, 2025
0e7cf6c
new naming for intent endpoints
david-ruiz-cko Nov 18, 2025
93f9c44
update and delete endpoints with id param
david-ruiz-cko Nov 18, 2025
6ec8580
new CreatePurchaseIntentCredentials endpoint, refactor using common c…
david-ruiz-cko Nov 18, 2025
43061e9
Added all tests for the new CreatePICredentials, UpdatePI and DeleteP…
david-ruiz-cko Nov 18, 2025
d8e10cc
Usiong Resource base instead of HttpMetadata, removed not needed Erro…
david-ruiz-cko Nov 19, 2025
e4fb74e
AgenticClientTest to SecretKeyOrOAuth authentication
david-ruiz-cko Nov 19, 2025
41e1abb
isolated the entities in a new namespace away from request, updated a…
david-ruiz-cko Nov 19, 2025
a6d6957
refactor names and clases
armando-rodriguez-cko Nov 21, 2025
ba2c2af
WIP Integrations tests
armando-rodriguez-cko Nov 21, 2025
777e58d
Changes done at names classes and distribution of files
david-ruiz-cko Nov 21, 2025
27c3cdf
MandateExtended does not need inherited members
david-ruiz-cko Nov 21, 2025
256afaf
remove unnecessary customer default assertion in InstrumentsIntegrati…
armando-rodriguez-cko Nov 24, 2025
e15d0f0
Potential fix for code scanning alert no. 173: Missed opportunity to …
armando-rodriguez-cko Nov 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/AgenticClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using System.Threading;
using System.Threading.Tasks;
using Checkout.AgenticCommerce.Requests;
using Checkout.AgenticCommerce.Responses;

namespace Checkout.AgenticCommerce
{
/// <summary>
/// Agentic Commerce API Client
/// </summary>
public class AgenticClient : AbstractClient, IAgenticClient
{
private const string AgenticPath = "agentic";
private const string EnrollPath = "enroll";
private const string PurchaseIntentPath = "purchase-intent";
private const string CredentialsPath = "credentials";

public AgenticClient(IApiClient apiClient, CheckoutConfiguration configuration) :
base(apiClient, configuration, SdkAuthorizationType.OAuth)
{
}

// Agentic Commerce enrollment
// ----------------------------------------------------------------

/// <summary>
/// Enroll a card for use with agentic commerce
/// [BETA]
/// </summary>
public Task<EnrollACardResponse> EnrollACard(
EnrollACardRequest enrollACardRequest,
CancellationToken cancellationToken = default)
{
CheckoutUtils.ValidateParams("agenticEnrollRequest", enrollACardRequest);
return ApiClient.Post<EnrollACardResponse>(
BuildPath(AgenticPath, EnrollPath),
SdkAuthorization(),
enrollACardRequest,
cancellationToken
);
}

// Purchase intents
// ----------------------------------------------------------------

/// <summary>
/// Create an agentic commerce purchase intent
/// [BETA]
/// </summary>
public Task<PurchaseIntentResponse> CreatePurchaseIntent(
PurchaseIntentCreateRequest purchaseIntentCreateRequest,
CancellationToken cancellationToken = default)
{
CheckoutUtils.ValidateParams("agenticPurchaseIntentCreateRequest", purchaseIntentCreateRequest);
return ApiClient.Post<PurchaseIntentResponse>(
BuildPath(AgenticPath, PurchaseIntentPath),
SdkAuthorization(),
purchaseIntentCreateRequest,
cancellationToken
);
}

/// <summary>
/// Create credentials for an agentic commerce purchase intent.
/// [BETA]
/// </summary>
public Task<PurchaseIntentResponse> CreatePurchaseIntentCredentials(string id,
PurchaseIntentCredentialsCreateRequest purchaseIntentCredentialsCreateRequest,
CancellationToken cancellationToken = default)
{
CheckoutUtils.ValidateParams("id", id,"agenticPurchaseIntentCredentialsCreateRequest",
purchaseIntentCredentialsCreateRequest);
return ApiClient.Post<PurchaseIntentResponse>(
BuildPath(AgenticPath, PurchaseIntentPath, id, CredentialsPath),
SdkAuthorization(),
purchaseIntentCredentialsCreateRequest,
cancellationToken
);
}

/// <summary>
/// Update an agentic commerce purchase intent
/// [BETA]
/// </summary>
public Task<PurchaseIntentResponse> UpdatePurchaseIntent(string id,
PurchaseIntentUpdateRequest purchaseIntentUpdateRequest,
CancellationToken cancellationToken = default)
{
CheckoutUtils.ValidateParams("id", id, "agenticPurchaseIntentUpdateRequest", purchaseIntentUpdateRequest);
return ApiClient.Put<PurchaseIntentResponse>(
BuildPath(AgenticPath, PurchaseIntentPath, id),
SdkAuthorization(),
purchaseIntentUpdateRequest,
cancellationToken
);
}

/// <summary>
/// Delete a purchase intent
/// Deletes a purchase intent for agentic commerce
/// </summary>
public Task<EmptyResponse> DeletePurchaseIntent(string id,
CancellationToken cancellationToken = default)
{
CheckoutUtils.ValidateParams("id", id);
return ApiClient.Delete<EmptyResponse>(
BuildPath(AgenticPath, PurchaseIntentPath, id),
SdkAuthorization(),
cancellationToken
);
}
}
}
29 changes: 29 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/Customer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Checkout.Common;

namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// The customer's details
/// </summary>
public class Customer
{
/// <summary>
/// The customer's email address
/// [Required]
/// </summary>
public string Email { get; set; }

/// <summary>
/// The customer's country, as a two-letter ISO 3166 country code
/// (https://www.checkout.com/docs/resources/codes/country-codes)
/// [Required]
/// </summary>
public CountryCode? CountryCode { get; set; }

/// <summary>
/// The customer's language, as a two-letter ISO 639 language code
/// [Required]
/// </summary>
public string LanguageCode { get; set; }
}
}
32 changes: 32 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/Device.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// The user's device
/// </summary>
public class Device
{
/// <summary>
/// The device's IP address
/// [Required]
/// </summary>
public string IpAddress { get; set; }

/// <summary>
/// The device's user agent
/// [Required]
/// </summary>
public string UserAgent { get; set; }

/// <summary>
/// The device brand
/// [Optional]
/// </summary>
public string DeviceBrand { get; set; }

/// <summary>
/// The device type
/// [Optional]
/// </summary>
public string DeviceType { get; set; }
}
}
9 changes: 9 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/Mandate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// Mandate configuration for purchase intents
/// </summary>
public class Mandate : MandateBase

Check warning on line 6 in src/CheckoutSdk/AgenticCommerce/Common/Mandate.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this empty class, write its code or make it an "interface".

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-net&issues=AZqmk5kwylK7ECoQTm4Q&open=AZqmk5kwylK7ECoQTm4Q&pullRequest=506
{
}
}
29 changes: 29 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/MandateBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// Mandate configuration for purchase intents
/// </summary>
public class MandateBase
{
/// <summary>
/// Purchase threshold configuration
/// </summary>
public PurchaseThreshold PurchaseThreshold { get; set; }

/// <summary>
/// A brief description of the purchase intent
/// &lt;= 255 characters
/// [Required]
/// </summary>
public string Description { get; set; }

/// <summary>
/// The date and time when the purchase intent expires, in ISO 8601 format.
/// This value must be set to a date and time in the future
/// [Required]
/// </summary>
public DateTime? ExpirationDate { get; set; }
}
}
16 changes: 16 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/MandateExtended.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// Mandate configuration for purchase intents
/// </summary>
public class MandateExtended: MandateBase
{
/// <summary>
/// The unique identifier for the mandate
/// [Required]
/// </summary>
public string Id { get; set; }
}
}
25 changes: 25 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/PurchaseIntentStatusType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Runtime.Serialization;

namespace Checkout.AgenticCommerce.Common
{
public enum PurchaseIntentStatusType
{
[EnumMember(Value = "active")]
Active,

[EnumMember(Value = "created")]
Created,

[EnumMember(Value = "cancelled")]
Cancelled,

[EnumMember(Value = "expired")]
Expired,

[EnumMember(Value = "declined")]
Declined,

[EnumMember(Value = "completed")]
Completed,
}
}
25 changes: 25 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/PurchaseThreshold.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Checkout.Common;

namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// Purchase threshold configuration
/// </summary>
public class PurchaseThreshold
{
/// <summary>
/// The maximum amount for the purchase
/// Format the amount (https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value)
/// according to the currency_code
/// [Required]
/// </summary>
public int Amount { get; set; }

/// <summary>
/// The currency to use for the purchase, as an ISO 4217 currency code
/// (https://www.checkout.com/docs/resources/codes/currency-codes)
/// [Required]
/// </summary>
public Currency? CurrencyCode { get; set; }
}
}
39 changes: 39 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/Source.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// The payment source to enroll
/// </summary>
public class Source
{
/// <summary>
/// The full card number, without separators
/// [Required]
/// </summary>
public string Number { get; set; }

/// <summary>
/// Card expiry month
/// [ 13 .. 19 ] characters
/// [Required]
/// </summary>
public int ExpiryMonth { get; set; }

/// <summary>
/// Card expiry year
/// [Required]
/// </summary>
public int ExpiryYear { get; set; }

/// <summary>
/// Payment source type
/// [Required]
/// </summary>
public string Type { get; set; }

/// <summary>
/// The card's 3 or 4 digit card verification value (CVV) or security code
/// [Optional]
/// </summary>
public string Cvv { get; set; }
}
}
25 changes: 25 additions & 0 deletions src/CheckoutSdk/AgenticCommerce/Common/TransactionAmount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Checkout.Common;

namespace Checkout.AgenticCommerce.Common
{
/// <summary>
/// Transaction amount information
/// </summary>
public class TransactionAmount
{
/// <summary>
/// The transaction amount
/// Format the amount (https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value)
/// according to the currency_code
/// [Required]
/// </summary>
public int Amount { get; set; }

/// <summary>
/// The transaction currency, as an ISO 4217 currency code
/// (https://www.checkout.com/docs/resources/codes/currency-codes)
/// [Required]
/// </summary>
public Currency? CurrencyCode { get; set; }
}
}
Loading
Loading