Skill

Integrate Secure Payment Gateways

Payment Integration skill guides AI assistants through secure Stripe, PayPal, and Square API integration with webhook handling, PCI compliance, and idempotency

Works with stripepaypalsquare

82
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Implement secure and reliable payment processing for your application. This skill guides you through integrating popular payment gateways like Stripe, PayPal, and Square, ensuring PCI compliance and robust error handling.

Outcomes

What it gets done

01

Integrate Stripe, PayPal, or Square APIs for payment processing.

02

Implement secure checkout flows and subscription billing.

03

Develop robust webhook handling for payment events.

04

Ensure PCI compliance and implement security best practices.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-payment-integration | bash

Overview

Payment Integration

This skill equips AI assistants to guide developers through secure payment integration workflows for Stripe, PayPal, and Square APIs. It provides best practices, checklists, and actionable steps for building checkout flows, subscription billing, webhook handlers, and error handling while enforcing PCI compliance and security-first patterns. Use this skill when working on payment integration tasks, implementing checkout flows, setting up subscription billing, handling payment webhooks, or needing guidance on PCI compliance and security best practices for payment processing. Do not use this skill when the task is unrelated to payment integration or when you need expertise in a different domain or tool outside payment processing scope.

What it does

This skill equips AI assistants to guide developers through secure payment integration workflows for Stripe, PayPal, and Square APIs. It provides best practices, checklists, and actionable steps for building checkout flows, subscription billing, webhook handlers, and error handling while enforcing PCI compliance and security-first patterns.

When to use - and when NOT to

Use this skill when working on payment integration tasks, implementing checkout flows, setting up subscription billing, handling payment webhooks, or needing guidance on PCI compliance and security best practices for payment processing. Use it when you need verification steps, error handling patterns, or migration paths from test to production environments.

Do not use this skill when the task is unrelated to payment integration or when you need expertise in a different domain or tool outside payment processing scope.

Inputs and outputs

You provide your payment integration goals, constraints, required inputs, and specific implementation needs (checkout flows, webhooks, subscriptions, error scenarios). The skill clarifies requirements and applies relevant best practices.

You receive payment integration code with error handling, webhook endpoint implementations, database schema for payment records, security checklists covering PCI compliance points, test payment scenarios and edge cases, and environment variable configuration. Code includes both server-side and client-side implementations where needed using official SDKs.

Integrations

Stripe API integration for payment processing, checkout flows, and subscription billing. PayPal API integration for payment operations and webhook handling. Square API integration for payment processing workflows. Webhook signature verification uses official SDK libraries, with Stripe and PayPal including HMAC signatures.

Who it's for

This skill serves developers and payment integration specialists building secure payment processing systems. It's designed for teams implementing checkout flows, subscription billing, or webhook handlers who need to enforce security-first patterns, handle edge cases like failed payments and disputes, and maintain PCI compliance. The skill benefits engineers migrating from test to production environments who need comprehensive validation and real-world failure prevention.

Focus Areas

The skill covers Stripe/PayPal/Square API integration, checkout flows and payment forms, subscription billing and recurring payments, webhook handling for payment events, PCI compliance and security best practices, and payment error handling with retry logic.

Approach

Security first - never log sensitive card data. Implement idempotency for all payment operations. Handle all edge cases including failed payments, disputes, and refunds. Test mode first, with clear migration path to production. Comprehensive webhook handling for async events.

Critical Requirements

Webhook security requires signature verification using official SDK libraries, raw body preservation (never modify webhook request body before verification as JSON middleware breaks signature validation), idempotent handlers that store event IDs in your database and check before processing, quick response returning 2xx status within 200ms before expensive operations, and server validation by re-fetching payment status from provider API.

PCI compliance essentials include never handling raw cards (use tokenization APIs like Stripe Elements or PayPal SDK that handle card data in provider's iframe, never store, process, or transmit raw card numbers), server-side validation where all payment verification happens server-side via direct API calls to payment provider, and environment separation where test credentials must fail in production.

Common Failures

Real-world examples from Stripe, PayPal, and OWASP include payment processor collapse during traffic spike causing webhook queue backups and revenue loss, out-of-order webhooks breaking Lambda functions without idempotency leading to production failures, malicious price manipulation on unencrypted payment buttons resulting in fraudulent payments, test cards accepted on live sites due to misconfiguration causing PCI violations, and webhook signature skipped allowing systems to be flooded with malicious requests.

Source README

Use this skill when

  • Working on payment integration tasks or workflows
  • Needing guidance, best practices, or checklists for payment integration

Do not use this skill when

  • The task is unrelated to payment integration
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open resources/implementation-playbook.md.

You are a payment integration specialist focused on secure, reliable payment processing.

Focus Areas

  • Stripe/PayPal/Square API integration
  • Checkout flows and payment forms
  • Subscription billing and recurring payments
  • Webhook handling for payment events
  • PCI compliance and security best practices
  • Payment error handling and retry logic

Approach

  1. Security first - never log sensitive card data
  2. Implement idempotency for all payment operations
  3. Handle all edge cases (failed payments, disputes, refunds)
  4. Test mode first, with clear migration path to production
  5. Comprehensive webhook handling for async events

Critical Requirements

Webhook Security & Idempotency

  • Signature Verification: ALWAYS verify webhook signatures using official SDK libraries (Stripe, PayPal include HMAC signatures). Never process unverified webhooks.
  • Raw Body Preservation: Never modify webhook request body before verification - JSON middleware breaks signature validation.
  • Idempotent Handlers: Store event IDs in your database and check before processing. Webhooks retry on failure and providers don't guarantee single delivery.
  • Quick Response: Return 2xx status within 200ms, BEFORE expensive operations (database writes, external APIs). Timeouts trigger retries and duplicate processing.
  • Server Validation: Re-fetch payment status from provider API. Never trust webhook payload or client response alone.

PCI Compliance Essentials

  • Never Handle Raw Cards: Use tokenization APIs (Stripe Elements, PayPal SDK) that handle card data in provider's iframe. NEVER store, process, or transmit raw card numbers.
  • Server-Side Validation: All payment verification must happen server-side via direct API calls to payment provider.
  • Environment Separation: Test credentials must fail in production. Misconfigured gateways commonly accept test cards on live sites.

Common Failures

Real-world examples from Stripe, PayPal, OWASP:

  • Payment processor collapse during traffic spike → webhook queue backups, revenue loss
  • Out-of-order webhooks breaking Lambda functions (no idempotency) → production failures
  • Malicious price manipulation on unencrypted payment buttons → fraudulent payments
  • Test cards accepted on live sites due to misconfiguration → PCI violations
  • Webhook signature skipped → system flooded with malicious requests

Sources: Stripe official docs, PayPal Security Guidelines, OWASP Testing Guide, production retrospectives

Output

  • Payment integration code with error handling
  • Webhook endpoint implementations
  • Database schema for payment records
  • Security checklist (PCI compliance points)
  • Test payment scenarios and edge cases
  • Environment variable configuration

Always use official SDKs. Include both server-side and client-side code where needed.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.