payments

ruby
class CreateStripeEvents < ActiveRecord::Migration[7.1]
  def change
    create_table :stripe_events do |t|
      t.string :stripe_event_id, null: false
      t.string :event_type, null: false
      t.string :status, null: false, default: "received"

Idempotent Stripe Webhook Processing in Rails with a Durable Event Log

rails stripe webhooks
by codesnips 4 tabs
sql
CREATE TABLE idempotency_keys (
    id              BIGSERIAL PRIMARY KEY,
    idempotency_key TEXT        NOT NULL,
    request_path    TEXT        NOT NULL,
    request_fingerprint TEXT    NOT NULL,
    status          TEXT        NOT NULL DEFAULT 'in_progress',

Idempotent POST Requests with an Idempotency-Key Middleware in Express

express idempotency middleware
by codesnips 3 tabs
python
import uuid
from django.db import models


class Cart(models.Model):
    OPEN = "open"

Prevent Duplicate Order Submissions in Django with select_for_update Row Locking

django postgres concurrency
by codesnips 3 tabs
typescript
import type { Redis } from "ioredis";

export interface StoredResponse {
  status: "pending" | "completed";
  fingerprint: string;
  httpStatus?: number;

Idempotent POST Requests in Express with a Redis-Backed Middleware

express redis idempotency
by codesnips 3 tabs
php
<?php

namespace App\Payment;

use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

Collect Tagged Payment Gateways with a Symfony Compiler Pass and Service Locator

symfony dependency-injection compiler-pass
by codesnips 4 tabs
php
<?php

namespace App\Controller;

use App\Message\ProcessStripeEvent;
use App\Webhook\StripeSignatureVerifier;

Verifying and Processing Stripe-Style Webhooks Idempotently in Symfony

symfony webhooks stripe
by codesnips 3 tabs
javascript
const express = require('express');
const webhookRouter = require('./webhookRouter');
const apiRouter = require('./apiRouter');

const app = express();

Verify Stripe Webhook Signatures with a Raw-Body Express Route

express stripe webhooks
by codesnips 3 tabs
java
@Entity
@Table(name = "idempotency_records",
       uniqueConstraints = @UniqueConstraint(columnNames = "idempotency_key"))
public class IdempotencyRecord {

    public enum Status { IN_PROGRESS, COMPLETED }

Idempotent POST Handling in Spring Boot with a Stored Idempotency-Key

spring-boot idempotency rest-api
by codesnips 3 tabs