Embed a Claim Button

How-To Guide: Add a credential claim button to any website using the LearnCard Embed SDK

Add a "Claim Credential" button to any webpage β€” a course completion page, an event landing page, an onboarding flow. When a user clicks it, a polished modal walks them through email verification and deposits the credential directly into their LearnCard wallet.

circle-info

This is for external websites that want to award credentials to visitors. If you're building an app that runs inside the LearnCard App Store, see Connect an Embedded App instead.

Prerequisites

  • A LearnCard developer account with an Embed integration created in the Developer Dashboardarrow-up-right

  • At least one credential template attached to that integration

  • Your integration's publishable key (pk_...)

Step 1: Create Your Integration & Template

  1. Go to the Developer Dashboard β†’ New Integration β†’ choose Embed Claim Button

  2. Follow the setup guide: set your partner name, create a credential template

  3. Copy your publishable key from the Embed Code tab

Step 2: Add the SDK

<script src="https://cdn.jsdelivr.net/npm/@learncard/embed-sdk@latest/dist/learncard.js"></script>

Step 3: Initialize the SDK

Add a target element and call init():

The credential name must match a template you created in the dashboard. The SDK resolves it server-side β€” you don't need to embed the full credential JSON.

Step 4: Customize Branding (Optional)

Step 5: Handle Success (Optional)

By default, after claiming, the SDK opens the wallet in a new tab (deep-linked to the credential via handoffUrl) and shows a success screen. You can hook into this with onSuccess:

To suppress the automatic wallet redirect entirely, set branding.walletUrl: '':

Claim Flow

spinner

Whitelisted Domains

For security, the API only accepts claims from domains you've whitelisted in the Embed Code tab of your dashboard. Add your production domain before going live.

During local development, localhost is allowed automatically.

Testing Locally

Use the included embed example to test without a real backend:

URL
Mode

http://localhost:4321

Stub mode β€” no backend, flows all the way to success

?pk=pk_xxx

Live network

?pk=pk_xxx&template=My+Template

Live network + template by name

?pk=pk_xxx&api=http://localhost:4000/api&template=My+Template

Fully local

Troubleshooting

"This integration could not be found" Your publishableKey doesn't match any active integration on the network. Double-check the key from your dashboard Embed Code tab and ensure your domain is whitelisted.

Credential not appearing after claim The credential lands in the user's inbox and is finalized when they next open their wallet. If you need to verify immediately, check the dashboard's activity tab.

OTP not arriving In local dev, check your brain-service logs β€” OTP codes are printed there when no email provider is configured.

See Also

Last updated

Was this helpful?