{
  "id": "pl_01HZXK8M9N2P3Q4R5S6T7U8V9W",
  "title": "Premium Subscription",
  "url": "https://checkout.devdraft.ai/premium-subscription",
  "description": "Monthly access to all premium features",
  "coverImage": "https://example.com/images/premium-subscription.jpg",
  "linkType": "PRODUCT",
  "status": "ACTIVE",
  "amount": 29.99,
  "paymentForId": null,
  "currency": "usdc",
  "allowQuantityAdjustment": true,
  "allowMobilePayment": true,
  "collectTax": true,
  "collectAddress": false,
  "limitPayments": true,
  "maxPayments": 1000,
  "customFields": {
    "subscription_tier": "premium",
    "billing_cycle": "monthly"
  },
  "paymentLinkProducts": [
    {
      "id": "plp_123456789",
      "productId": "prod_987654321",
      "quantity": 1,
      "product": {
        "id": "prod_987654321",
        "name": "Premium Subscription",
        "description": "Access to all premium features",
        "price": 29.99,
        "currency": "usdc",
        "images": [
          "https://example.com/images/premium-product.jpg"
        ]
      }
    }
  ],
  "isForAllProduct": false,
  "appId": "app_123456789",
  "customerId": null,
  "taxId": "tax_456789123",
  "tax": {
    "id": "tax_456789123",
    "name": "Sales Tax",
    "percentage": 8.5,
    "description": "Standard sales tax"
  },
  "expiration_date": "2024-12-31T23:59:59.000Z",
  "createdAt": "2023-07-01T12:00:00.000Z",
  "updatedAt": "2023-07-15T09:30:00.000Z"
}
The Fetch Payment Link API enables you to retrieve detailed information about a specific payment link using its unique identifier. This endpoint provides complete payment link details including products, tax configuration, and custom fields.

Endpoint Details

method
string
GET
url
string
/api/v0/payment-links/{id}
Authentication: Required (API Key & Secret)

Authentication

All requests require API key authentication using the following headers:
  • x-client-key: Your application’s client key
  • x-client-secret: Your application’s client secret

Path Parameters

id
string
required
Unique payment link identifier
Example: "pl_01HZXK8M9N2P3Q4R5S6T7U8V9W"

Request Examples

curl -X GET "https://api.devdraft.ai/api/v0/payment-links/pl_01HZXK8M9N2P3Q4R5S6T7U8V9W" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET"

Response Format

Success Response (200 OK)

{
  "id": "pl_01HZXK8M9N2P3Q4R5S6T7U8V9W",
  "title": "Premium Subscription",
  "url": "https://checkout.devdraft.ai/premium-subscription",
  "description": "Monthly access to all premium features",
  "coverImage": "https://example.com/images/premium-subscription.jpg",
  "linkType": "PRODUCT",
  "status": "ACTIVE",
  "amount": 29.99,
  "paymentForId": null,
  "currency": "usdc",
  "allowQuantityAdjustment": true,
  "allowMobilePayment": true,
  "collectTax": true,
  "collectAddress": false,
  "limitPayments": true,
  "maxPayments": 1000,
  "customFields": {
    "subscription_tier": "premium",
    "billing_cycle": "monthly"
  },
  "paymentLinkProducts": [
    {
      "id": "plp_123456789",
      "productId": "prod_987654321",
      "quantity": 1,
      "product": {
        "id": "prod_987654321",
        "name": "Premium Subscription",
        "description": "Access to all premium features",
        "price": 29.99,
        "currency": "usdc",
        "images": [
          "https://example.com/images/premium-product.jpg"
        ]
      }
    }
  ],
  "isForAllProduct": false,
  "appId": "app_123456789",
  "customerId": null,
  "taxId": "tax_456789123",
  "tax": {
    "id": "tax_456789123",
    "name": "Sales Tax",
    "percentage": 8.5,
    "description": "Standard sales tax"
  },
  "expiration_date": "2024-12-31T23:59:59.000Z",
  "createdAt": "2023-07-01T12:00:00.000Z",
  "updatedAt": "2023-07-15T09:30:00.000Z"
}

Response Fields

id
string
Unique payment link identifier
title
string
Display title of the payment link
url
string
Full checkout URL for the payment link
description
string | null
Description of the payment link
coverImage
string | null
Cover image URL
Type of payment link (PRODUCT, DONATION, SUBSCRIPTION)
status
string
Current status (ACTIVE, INACTIVE, EXPIRED)
amount
number | null
Fixed amount (null for flexible amounts)
currency
string
Payment currency (usdc, eurc)
allowQuantityAdjustment
boolean
Whether quantity adjustment is allowed
allowMobilePayment
boolean
Whether mobile payments are allowed
collectTax
boolean
Whether tax collection is enabled
collectAddress
boolean
Whether address collection is enabled
limitPayments
boolean
Whether payment count is limited
maxPayments
number | null
Maximum number of payments allowed
customFields
object | null
Custom fields for data collection
Array of associated products with detailed information
tax
object | null
Tax configuration details (when collectTax is true)
appId
string
Application identifier
expiration_date
string | null
Expiration date (ISO 8601)
createdAt
string
Creation timestamp (ISO 8601)
updatedAt
string
Last update timestamp (ISO 8601)

Error Responses

{
  "statusCode": 401,
  "message": "Unauthorized - Invalid API credentials",
  "error": "Unauthorized"
}

Use Cases

1. Customer Support

Quickly retrieve payment link details when customers have questions or issues with their payments.

2. Status Verification

Check if a payment link is active and available before sharing it with customers or including it in communications.

3. Administrative Interface

Display detailed payment link information in dashboards and management tools.

4. Integration Validation

Verify payment link configuration and settings during integration testing.

5. Audit and Compliance

Retrieve complete payment link records for audit trails and compliance reporting.

Best Practices

Error Handling

  • Always check for 404 errors when the payment link might not exist
  • Handle 403 errors gracefully if accessing links from other applications
  • Implement retry logic for temporary network issues

Data Validation

  • Verify payment link status before using in production
  • Check expiration dates to ensure links are still valid
  • Validate that required fields are present for your use case

Performance Optimization

  • Cache payment link data when appropriate to reduce API calls
  • Use the fetch endpoint sparingly for frequently accessed links
  • Consider using the list endpoint with filters for bulk operations

Security Considerations

  • Never expose payment link data to unauthorized users
  • Validate user permissions before displaying payment link details
  • Use HTTPS for all API requests

Integration Examples

class PaymentLinkValidator {
  constructor(api) {
    this.api = api;
  }

  async validateForCheckout(linkId) {
    try {
      const analytics = await this.api.getPaymentLinkAnalytics(linkId);
      const { link, isExpired, effectiveStatus } = analytics;

      // Check basic availability
      if (effectiveStatus !== 'active') {
        return {
          valid: false,
          reason: `Payment link is ${effectiveStatus}`,
          code: `LINK_${effectiveStatus.toUpperCase()}`
        };
      }

      // Check payment limits
      if (link.limitPayments && link.maxPayments <= 0) {
        return {
          valid: false,
          reason: 'Payment limit reached',
          code: 'LIMIT_REACHED'
        };
      }

      // Check if close to expiration
      if (analytics.daysUntilExpiration <= 1) {
        return {
          valid: true,
          warning: `Payment link expires in ${analytics.daysUntilExpiration} day(s)`,
          code: 'EXPIRES_SOON'
        };
      }

      return {
        valid: true,
        link: link
      };

    } catch (error) {
      return {
        valid: false,
        reason: error.message,
        code: 'FETCH_ERROR'
      };
    }
  }

  async getPublicLinkInfo(linkId) {
    try {
      const link = await this.api.fetchPaymentLink(linkId);
      
      // Return only public information
      return {
        title: link.title,
        description: link.description,
        coverImage: link.coverImage,
        amount: link.amount,
        currency: link.currency,
        allowQuantityAdjustment: link.allowQuantityAdjustment,
        collectAddress: link.collectAddress,
        collectTax: link.collectTax,
        customFields: link.customFields
      };
    } catch (error) {
      throw new Error('Payment link not available');
    }
  }
}

Support

For additional support with the Fetch Payment Link API:
  1. Ensure you’re using the correct payment link ID format
  2. Verify API key permissions for payment link access
  3. Check that the payment link belongs to your application
  4. Handle 404 errors gracefully for non-existent links