> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revtain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Card Update Link

> Generate a secure, time-limited URL that your customer can visit to update their payment method.

The page is branded to your business — your customer sees your name, not Revtain's.

- URL is valid for **72 hours** and can only be used once
- When the customer updates their card, you'll receive a `card.updated` webhook
- For a seamless customer experience, configure a custom domain (CNAME `pay.yourdomain.com` → `api.revtain.com`)




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/recovery/update-card/generate
openapi: 3.0.3
info:
  title: Revtain API
  description: >
    Recover failed payments. No checkout changes. Works with your existing
    payment stack.


    ## Choose Your Path


    **Using Chargebee, Recurly, Stripe Billing, Braintree, Zuora, or Shopify
    (ReCharge)?**

    Use a Connector — paste one webhook URL, no code, 5 minutes.


    **Custom billing system or want full API control?**

    Use the Recovery Engine directly. The quickstart gets you to a working
    recovery call in 60 seconds.


    ## Authentication


    Pass your API key via the `X-API-KEY` header on all requests:


    ```

    X-API-KEY: rev_dTviCg52T8gLPCjrrW4KA0NKf_f5pQgk

    ```


    Keep this secret. Your API key can trigger charges. Never expose it in
    client-side code, public repos, or logs.


    ## Base URL


    ```

    https://api.revtain.com

    ```


    Same URL for testing and production. Test mode is controlled by your gateway
    type — onboard with a test gateway (e.g., Stripe `sk_test_...`) for sandbox,
    live key for production.
  version: 1.0.0
  contact:
    email: support@revtain.com
servers:
  - url: https://api.revtain.com
    description: Production & Sandbox (test mode controlled by gateway key)
security:
  - ApiKeyAuth: []
tags:
  - name: Recovery Engine
    description: Trigger and track payment recovery attempts
  - name: Predictive Risk Engine
    description: Pre-screen payments before they fail
  - name: Retention
    description: Hosted cancel flow to reduce voluntary churn
  - name: Health
    description: Service health check
paths:
  /api/recovery/update-card/generate:
    post:
      tags:
        - Recovery Engine
      summary: Generate Card Update Link
      description: >
        Generate a secure, time-limited URL that your customer can visit to
        update their payment method.


        The page is branded to your business — your customer sees your name, not
        Revtain's.


        - URL is valid for **72 hours** and can only be used once

        - When the customer updates their card, you'll receive a `card.updated`
        webhook

        - For a seamless customer experience, configure a custom domain (CNAME
        `pay.yourdomain.com` → `api.revtain.com`)
      operationId: generateCardUpdateLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CardUpdateRequest'
            example:
              paymentMethodToken: pm_1234567890
      responses:
        '201':
          description: Card update link created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CardUpdateResponse'
              example:
                url: >-
                  https://pay.yourdomain.com/api/recovery/update-card/abc123xyz...
                token: abc123xyz...
                expiresAt: '2026-04-23T14:30:00.000Z'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
components:
  schemas:
    CardUpdateRequest:
      type: object
      required:
        - paymentMethodToken
      properties:
        paymentMethodToken:
          type: string
          description: The token for the card that needs updating.
          example: pm_1234567890
    CardUpdateResponse:
      type: object
      properties:
        url:
          type: string
          format: uri
          example: https://pay.yourdomain.com/api/recovery/update-card/abc123xyz...
        token:
          type: string
          example: abc123xyz...
        expiresAt:
          type: string
          format: date-time
          example: '2026-04-23T14:30:00.000Z'
    ValidationError:
      type: object
      properties:
        error:
          type: string
          example: Validation failed.
        details:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            paymentMethodToken:
              - Payment method token is required
            amount:
              - Amount must be a positive number
    UnauthorizedError:
      type: object
      properties:
        error:
          type: string
          example: Unauthorized. Missing or invalid API key.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: 'Your Revtain API key (format: `rev_xxx`). Provided during onboarding.'

````