Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created April 8, 2026 16:39
Show Gist options
  • Select an option

  • Save dcomartin/546f2c2d43a8844f39d6519ccbd0e7fd to your computer and use it in GitHub Desktop.

Select an option

Save dcomartin/546f2c2d43a8844f39d6519ccbd0e7fd to your computer and use it in GitHub Desktop.
public class ProcessPayment
{
public record Command(decimal Amount, string Token);
public class Handler
{
public async Task Handle(Command command)
{
var chargeService = new ChargeService();
var charge = await chargeService.CreateAsync(new ChargeCreateOptions
{
Amount = (long)(command.Amount * 100),
Currency = "usd",
Source = command.Token
});
var paymentId = charge.Id;
// save result, publish event, etc.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment