Flash Documentation
  • Welcome to the Flash Documentation!
  • Getting Started
    • Connect Your Wallet
      • Coinos Wallet
  • Products
    • Checkouts
      • Payment Links
      • Donation Widget
      • Page Paywalls
      • Payment Buttons
      • Video Paywalls
    • Subscriptions
      • Getting Started
        • Create a Subscription Plan
        • Pre-Fill User Details
      • Authentication
      • Endpoints
      • Webhooks
    • Stores
      • Managing Products
      • Hosted Store
      • Point of Sale
  • Integrations
    • WooCommerce
    • Shopify
    • Wix
  • API DOCUMENTATION
    • Welcome
    • Authentication
    • Subscriptions
      • Subscription-specific Authentication
      • Endpoints
      • Webhooks
  • NEED MORE HELP?
    • Contact Us
Powered by GitBook
On this page
  • Getting Your Subscription API Token
  • How to Include the Token in Your Requests
  • Error Handling
  • Common Authentication Errors
  • Sample Request With Authentication
  • Important Notes:
Export as PDF
  1. Products
  2. Subscriptions

Authentication

PreviousPre-Fill User DetailsNextEndpoints

Last updated 8 months ago

To ensure secure access, all requests to the Subscription API require an Authorization token. This token is unique for each subscription and must be included in the header of every API call. Here's how to authenticate your requests:

Getting Your Subscription API Token

After you create a subscription in the Flash web app, a unique Subscription API token is automatically generated. You can always retrieve this token from the subscription edit screen. Make sure not to confuse this with the global API token—each subscription has its own token.


How to Include the Token in Your Requests

For every API request, the token must be included in the Authorization header, formatted as follows:

Authorization: Bearer <Your-Subscription-API-Token>

Make sure to replace <Your-Subscription-API-Token> with the actual token you've obtained from the Flash web app.

Token Example

Here’s an example of how to structure your Authorization header in a typical API request:

POST https://api.paywithflash.com/v1/get_user_subscription_details
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cC...
Content-Type: application/x-www-form-urlencoded

Error Handling

  • If the token is missing or invalid, you will receive a 401 Unauthorized error.

  • For expired tokens, you will get a Token has expired message.

Common Authentication Errors

  • 401 Unauthorized: Occurs when the token is invalid, missing, or expired.

  • Invalid Token Format: Ensure that the token is sent as Bearer <token> and is properly formatted.

Sample Request With Authentication

curl -X POST https://api.paywithflash.com/v1/get_user_subscription_details \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cC..." \
-d "email=user@example.com&flash_id=12345"

Important Notes:

  • Never share your Subscription API token publicly.

  • Make sure to use the correct subscription token for each individual subscription.

Page cover image