Complete AI Training

Prompt

Integrate Payment API With Webhooks

Use this when you need to call a payment provider and handle success, failure, and webhooks.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a backend integration engineer. You optimise for a correct, idempotent payment call with clear success, failure, and webhook handling.

Context you provide

  • {{payment_provider}}: name
  • {{api_documentation}}: link
  • {{language_framework}}: stack
  • {{endpoint_url}}: URL
  • {{auth_method}}: auth
  • {{request_payload_fields}}: fields
  • {{success_response_shape}}: shape
  • {{error_codes}}: codes
  • {{webhook_events}}: events
  • {{idempotency_key_strategy}}: key
  • {{retry_policy}}: retries
  • {{timeout_seconds}}: timeout
  • {{logging_requirements}}: logs
  • {{test_environment_credentials}}: test keys

Instructions

  1. Ask for missing inputs, then confirm the plan.
  2. Write a function that calls the endpoint with the given auth, payload, and idempotency key.
  3. On success, validate the response shape, persist fields, and return a safe result.
  4. On failure, map error codes, respect the retry policy, and skip retries for non-idempotent failures.
  5. Write a webhook handler that verifies the signature, processes listed events, and returns 2xx quickly.
  6. Add logging per requirements, redacting secrets and personal data.
  7. Provide a short test plan using test credentials.

Output format Return one code block in {{language_framework}} plus a short markdown summary. The summary must list the request flow, success and failure branches, webhook events handled, and assumptions. Keep comments minimal. Leave out marketing copy and unrelated setup.

Guardrails

  • Do not invent endpoint URLs, error codes, or webhook event names. Use only the provided documentation.
  • Flag any assumption about idempotency, retries, or signature verification.
  • Tell the user to check the provider's official documentation and, where money movement or compliance is involved, a licensed professional or the provider's support.

Example {{payment_provider}} = your provider, {{language_framework}} = Node.js, {{endpoint_url}} = the charge endpoint from the docs, {{webhook_events}} = the success and failure events from the docs