Skip to content

Installation

Learn how to add CryptumPay Widget to your website.

CDN Installation

The easiest way to use CryptumPay Widget is via CDN. No build tools or package managers required.

Basic Installation

Add this script tag to your HTML:

html
<script
  src="https://cdn.cryptumpay.com/2.3.2/widget.min.js"
  async
  integrity="sha384-jOAC1EYj7n6L3AUMR8dzHWi2B64sOghCmTyjCR2sqlZr4vw3YbabmSnHVyjnx8i6"
  crossorigin="anonymous"
></script>

Required Attributes

AttributeRequiredDescription
src✅ YesCDN URL with version number
integrity✅ YesSRI hash for security verification
crossorigin✅ YesMust be "anonymous" for CORS
async⚠️ RecommendedLoads widget asynchronously

SECURITY WARNING

The integrity attribute is mandatory. It prevents loading tampered code.

Always copy the complete script tag from docs.cryptumpay.com - don't manually type URLs or integrity hashes.

Version Management

Finding Current Version

The current widget version and integrity hash are always available at the top of this page in the Basic Installation section.

This page is updated with each new release, so always refer to it for the latest version and correct integrity hash.

You can also check the manifest programmatically:

https://cdn.cryptumpay.com/{version}/manifest.json

Example:
https://cdn.cryptumpay.com/2.3.2/manifest.json

Updating Versions

When updating to a new version:

  1. Get the new script tag from this page
  2. Update src and integrity together
  3. Test on staging environment
  4. Deploy to production

INTEGRITY HASH CHANGES

The integrity hash changes with every version. You must update both attributes together.

Loading Modes

Load the widget without blocking page rendering:

html
<script
  src="https://cdn.cryptumpay.com/2.3.2/widget.min.js"
  async
  integrity="sha384-jOAC1EYj7n6L3AUMR8dzHWi2B64sOghCmTyjCR2sqlZr4vw3YbabmSnHVyjnx8i6"
  crossorigin="anonymous"
></script>

<script>
// Wait for widget to load
document.addEventListener('CryptumPay:ready', (event) => {
  const button = new event.detail.Button('payment-button');
});
</script>

Benefits:

  • ✅ Faster initial page load
  • ✅ Doesn't block HTML parsing
  • ✅ Better Core Web Vitals scores
  • ✅ Recommended for production

Considerations:

  • ⚠️ Must use CryptumPay:ready event
  • ⚠️ Button initialization is delayed

Best Practice

Always wait for the CryptumPay:ready event before creating button instances to ensure the widget is fully loaded.

Synchronous Loading

Load the widget immediately:

html
<script
  src="https://cdn.cryptumpay.com/2.3.2/widget.min.js"
  integrity="sha384-jOAC1EYj7n6L3AUMR8dzHWi2B64sOghCmTyjCR2sqlZr4vw3YbabmSnHVyjnx8i6"
  crossorigin="anonymous"
></script>

<script>
// Widget is immediately available
const button = new CryptumPay.Button('payment-button');
</script>

Benefits:

  • ✅ Immediate availability
  • ✅ Simpler code
  • ✅ Good for testing

Considerations:

  • ⚠️ Blocks page rendering
  • ⚠️ Slower initial load
  • ⚠️ Not recommended for production

Comparison

FeatureAsyncSync
Page Load Speed✅ Fast⚠️ Slower
Code Simplicity⚠️ Event required✅ Direct access
Production Use✅ Recommended⚠️ Not recommended
SEO Impact✅ Better⚠️ Worse

Placement in HTML

Place the script in <head> with async:

html
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>My Store</title>
  
  <!-- CryptumPay Widget -->
  <script
    src="https://cdn.cryptumpay.com/2.3.2/widget.min.js"
    async
    integrity="sha384-jOAC1EYj7n6L3AUMR8dzHWi2B64sOghCmTyjCR2sqlZr4vw3YbabmSnHVyjnx8i6"
    crossorigin="anonymous"
  ></script>
</head>
<body>
  <!-- Your content -->
  <div id="payment-button"></div>
  
  <!-- Initialize after DOM ready -->
  <script>
  document.addEventListener('CryptumPay:ready', (event) => {
    const button = new event.detail.Button('payment-button');
  });
  </script>
</body>
</html>

Alternative: Before </body>

If you prefer, place it before closing </body>:

html
<body>
  <!-- Your content -->
  <div id="payment-button"></div>

  <script>
  document.addEventListener('CryptumPay:ready', (event) => {
    const button = new event.detail.Button('payment-button');
  });
  </script>
  
  <!-- Load widget -->
  <script
    src="https://cdn.cryptumpay.com/2.3.2/widget.min.js"
    async
    integrity="sha384-jOAC1EYj7n6L3AUMR8dzHWi2B64sOghCmTyjCR2sqlZr4vw3YbabmSnHVyjnx8i6"
    crossorigin="anonymous"
  ></script>
</body>

Verification

Check Installation

Open browser console and verify the widget loaded:

javascript
console.log(typeof CryptumPay); // Should log "object"
console.log(CryptumPay.Button);  // Should log function

Integrity Verification

If integrity check fails, you'll see an error:

Failed to find a valid digest in the 'integrity' attribute

Solution:

  1. Get the correct script tag from docs
  2. Copy both src and integrity attributes
  3. Ensure no typos or modifications

Next Steps

Released under the MIT License.