Subscription Management
Storefront Component
A container component that displays either the beam-impact-overview
or beam-redeem-transaction
widget, depending on the subscription's redemption status, and provides functionality to switch between nonprofits.
Properties
- apiKey (required): The beam provided SDK API key used for authentication
- subscriptionId (required): The ID of the subscription
- storeId (required) - Your Beam Store Id for the given site that Beam is being integrated into
- email (required): The email of the user associated with the subscription
- partnerUserId (optional): The client’s partner user ID of the user associated with the subscription
- postalCode (optional but required for regionalization): The postal code for regionalization purposes
- countryCode (optional but required for regionalization): The country code for regionalization purposes
- lang (optional): Beam supports changing the displayed language based on a
lang
parameter passed into the widgets. If your site supports multiple languages, this Liquid variable value should be updated based on any existing language detection method available in the theme. The supported values for this property can be found in the Beam Supported Languages documentation. defaults to English. - baseUrl (optional): If using staging environment, you'd need to add base URL and set it equal to "https://api-staging.beamimpact.com"
Usage
<script
type="module"
async
crossorigin
src="https://sdk.beamimpact.com/web-sdk/{{ sdk_version }}/dist/components/subscription-management.esm.js"
></script>
<beam-subscription-management
apiKey="{{ storefront_component_api_key }}" <!-- required -->
subscriptionId="{{ your subscription id }}" <!-- required -->
storeId="{{ store_id }}" <!-- required -->
email="{{ user's email }}" <!-- required -->
partnerUserId="{{ user's user id }}" <!-- optional -->
></beam-subscription-management>
Get the nonprofit for a subscription
If a subscription has been registered in Beam’s system, this API endpoint can be used to find the nonprofit being supported by that subscription, if any.
Authorization
This endpoint takes the same Storefront Component API key that is used in your web components.
Authorization: "Api-Key {{ storefront_component_api_key }}";
Endpoint
POST https://api.beamimpact.com/api/v3/subscriptions/findNonprofitForSubscription
Body
{
"remoteSubscriptionId": "{{ subscriptionId }}", // String, required
"email": "{{ email }}" // String, required
}
Response
{
"id": {{ nonprofitId }}, // Int
"name": "{{ nonprofitName }}", // String
"cause": "{{ causeName }}", // String
}
This endpoint will return null
in any of the following cases:
- The subscription does not exist
- The email provided does not match the email for the subscription
- There is no nonprofit being supported by the subscription