All Collections
Shopify Subscription App
Customizing PayWhirl on Shopify
How to send emails and SMS messages with our Klaviyo integration
How to send emails and SMS messages with our Klaviyo integration

Learn how to use PayWhirl subscriptions with Klaviyo's advanced marketing tools to implement powerful email and SMS strategies.

Ryan P. avatar
Written by Ryan P.
Updated over a week ago

THIS FEATURE IS IN BETA - WE APPRECIATE YOUR FEEDBACK!

Our Klaviyo integration combines PayWhirl's robust subscription management capabilities with Klaviyo's powerful marketing tools. Shopify merchants can leverage Klaviyo's advanced email and SMS communication strategies to enhance customer engagement and grow their business.

Key Benefits

  • Seamless Integration: Effortlessly connect your PayWhirl subscription data with Klaviyo.

  • Automated Communication: Send targeted emails and SMS messages based on subscription events.

  • Enhanced Customer Insights: Utilize comprehensive subscription data for personalized marketing.

We've included a basic SMS and an Email example below.

Setting up the integration

To ensure you have the most complete data available, install the Klaviyo Shopify App if you haven't already.

Next, connect your Klaviyo account from the PayWhirl Settings page.

For PayWhirl to function properly, we require access to Accounts, Events, Lists, and Profiles from your Klaviyo account.

After connecting with Klavio, the PayWhirl settings section will show the connection.

NOTE: The first time you connect PayWhirl to Klaviyo, you'll most likely want to import your existing subscriber information by clicking the Import Profiles button in PayWhirl. This will sync your subscriber information with Klaviyo, so it's current.

PayWhirl events sent to Klaviyo

The integration supports the following PayWhirl events, enabling you to tailor your marketing strategies effectively:

  • PayWhirl - Test // manually sent from the settings page

  • PayWhirl - Subscription Created

  • PayWhirl - Subscription Paused

  • PayWhirl - Subscription Resumed

  • PayWhirl - Subscription Cancelled

  • PayWhirl - Subscription Expired

  • PayWhirl - Subscription Payment Failed (retrying)

  • PayWhirl - Subscription Payment Failed (last attempt)

  • PayWhirl - Subscription Payment Succeeded

PayWhirl profile data sent to Klaviyo

When these events occur, Klaviyo profiles are updated with relevant subscription data, including:

  • Active, paused, and finished subscription counts.

  • Product and variant IDs for ongoing and completed subscriptions.

  • Date of the last order and next order.

  • Links to the customer portal.

"pw_active_subscription_count": 0, //number
"pw_paused_subscription_count": 1, //number
"pw_finished_subscription_count": 1, //number
"pw_unfinished_subscriptions_product_ids": "6579809812646,6579809812646", // comma separated list of all product ids this customer is subscribing
"pw_unfinished_subscriptions_variant_ids": "39403889295526,39403889295526", // comma separated list of all variant ids this customer is subscribing
"pw_finished_subscriptions_product_ids": "6579809812646,6579809812646", //comma separated list of product ids this customer has finished subscribing (he may have active subscriptions with these products though)
"pw_finished_subscriptions_variant_ids": "39403889295526,39403889295526", // comma separated list of variant ids this customer has finished subscribing (he ma have active subscriptions with these variants though)
"pw_last_order_date": "2022-03-09T12:47:09.000000Z", // date of last subscription related order
"pw_portal_link": <link to customer portal>,
"pw_next_order_date": "2024-03-09T12:47:09.000000Z" // closest payment date (from all active subscriptions)
"pw_next_order_subscription": <subscription data>
"pw_all_subscriptions_data": // json formatted all subscriptions data
{
"1344176294": <subscription data>,
"2120351910": <subscription data>,
...
}

Subscription data in JSON format:

{ 
"id": 1344176294,
"nextOrderDate": "2024-03-09T12:47:09.000000Z",
"createdAt": "2021-07-27T07:05:58.000000Z",
"status": "ACTIVE",
"deliveryInterval": "MONTH",
"deliveryIntervalCount": 1,
"billingInterval": "MONTH",
"billingIntervalCount": 4,
"deliveryPrice": "$0.00",
"subtotalPrice": "$xx.xx"
"discountedDeliveryPrice": "$0.00",
"formattedShippingAddress": "123 Main Street\nAnytown\nUSA 12345",
"subscriptionLink": <link to customer portal>
"updatePaymentLink": <lint to update payment in customer portal>
"lines": [
{
"title": "Trip to Krakow - 123 / Black",
"sku": "1234",
"currentPrice": "$80.00",
"lineDiscountedPrice": "$80.00",
"productId": 6579809812646,
"productVariantId": 39403889295526,
"quantity": 1,
"sellingPlanName": "Every month"
}
]
}

Event Properties

The event properties "subscription_id" and "subscription_data" are used in Klaviyo to track specific actions or occurrences related to user profiles. In the context of PayWhirl and Klaviyo integration, these properties would serve specific functions:

  1. "subscription_id": This property represents the unique identifier of a subscription within PayWhirl. It is used in Klaviyo to relate the event (like subscription creation, pause, or cancellation) to a specific subscription in your system. This identifier helps segment users, analyze subscription patterns, and tailor marketing communications based on the subscription status or type.

  2. "subscription_data": This is a more comprehensive property encompassing all relevant subscription data. This could include subscription status (active, paused, etc.), dates (creation, next billing), pricing information, and product details. In Klaviyo, this data can be used for detailed analysis, creating personalized marketing campaigns, and understanding user behavior toward their subscriptions.

"subscription_id" => $sc->rest_id,
"subscription_data" => <subscription data>

For more detailed information on how these properties are used within Klaviyo and how you can leverage them for your marketing needs, please refer to Klaviyo's documentation on Events API overview, Profile properties reference, and Message personalization reference.

Failed payment SMS example

Now that PayWhirl is connected to Klaviyo, it's time to create a Flow. In this example, we'll send an SMS message to subscribers who've failed a payment.

Start by clicking Create Flow > Create from Scratch in Klaviyo and give the flow a name like "Failed Subscriber Payment." Then, you'll need to set the Trigger for the flow under Your Metrics > API > PayWhirl - Subscription Payment Failed (retrying).

Next, you can drag the SMS (or email) action block over and then edit the content of the message that will be sent.

Lastly, we'll copy the code below and paste it into the content section of the SMS message. We can also preview how the text message will appear to customers and see all the event properties for each preview customer.

Oops, it looks like there was a problem with your payment for subscription #{{ event|lookup:"subscription_id" }}. Click the following link, and we'll email you a secure link to update your card on file.

{{ event|lookup:"subscription_data"|lookup:"updatePaymentLink" }}

Please feel free to customize the content as needed. This is just a basic example, but you can personalize the message and use any variables we (or Klaviyo) support in your message.

Payment notification email example

Like the SMS example above, you'll need to create a flow from scratch in Klaviyo and give it a name like "Subscriber Payment Notification."

However, this time, you will set the Trigger to use a Date Property under Select a trigger > Recommended > Date Property in Klaviyo. This will allow you to use the next payment date to specify when the notification will be sent.

Next, you'll need to select pw_next_order_date for the date property and configure the settings you'd like. In this example, we'll set the trigger to send the message three days before the next order date and set it to repeat monthly.

Next, you just need to select an email template and paste the example content below into the content. Please feel free to modify the message as you see fit.

Hey {{ first_name|default:"" }}, this a reminder that your subscription #{{ person|lookup:"pw_next_order_subscription"|lookup:"id" }} payment of {{ person|lookup:"pw_next_order_subscription"|lookup:"subtotalPrice" }} will process on {{ person|lookup:"pw_next_order_date"|format_date_string|date:'m-d-Y' }}. If you'd like to make any changes, you can do so at the following link.

Edit subscription button URL
If you'd like to include a direct link so customers can edit their subscriptions, you can use the following variable in your content, and it will output a URL when rendered. In our example, the URL of the "Edit Subscription" button is set to the following.

{{ person|lookup:"pw_next_order_subscription"|lookup:"subscriptionLink" }}

Loop through line items (advanced, may require a developer)
You can also use Klaviyo's email template language to display more advanced subscription information. For example, listing all the items associated with the subscription.

{% for item in person|lookup:"pw_next_order_subscription"|lookup:"lines" %}{{ forloop.counter }}: {{ item|lookup:"title" }}
{% endfor %}

Available Klaviyo filters:


Other native Django filters:

https://docs.djangoproject.com/en/4.0/ref/templates/builtins/

This integration opens up a new realm of possibilities for Shopify merchants to engage with their subscribers more personally and effectively. By combining the strengths of PayWhirl's subscription management and Klaviyo's marketing prowess, you're set to elevate your customer experience and boost your business growth.

Please let us know if you have any questions or feedback; we'll do our best to help.

Team PayWhirl

Did this answer your question?