Automation

Shopify Flow

Cardigan integrates with Shopify Flow, letting you react to gift card events and perform gift card operations as part of your own automated workflows.

This is the most flexible part of Cardigan. Anything Flow can connect to - Slack, email, your ERP, a custom HTTP endpoint - can be driven by a Cardigan event, or can drive a Cardigan operation.


Triggers

Triggers start a Flow workflow when something happens in Cardigan.

Issued card status changed

Runs whenever an issued card moves from one status to another.

The workflow receives:

  • Status change - the previous status and the new status. Statuses are pending, scheduled, provisioning, provisioned, failed and cancelled.
  • Issued card - the full card record, including its amount and currency, card type (digital or physical), source, the Shopify order and transaction it came from, its recipient metadata, provider details, and any failures recorded against it.

Because you receive both the previous and new status, you can distinguish a card that has just been provisioned from one that has been retried, or catch only the transition into failed.

Redeemed card status changed

Runs whenever a redemption moves from one status to another. Statuses are pending, redeeming, redeemed, failed and cancelled.

The workflow receives the status change and the full redemption record, including the amount, the Shopify order name and ID, the payment and transaction IDs, the card involved, and any failures.

Actions

Actions let a Flow workflow perform a gift card operation through Cardigan.

Get card balance

Looks up a card's balance with your provider.

FieldRequiredNotes
NumberYesThe gift card number to check
PINNoThe card's PIN, if your program uses them
CurrencyNoOnly needed if the card's currency differs from your store's default

Returns whether the lookup succeeded and, if so, the card's balance, status and expiry date.

Redeem card

Attempts to redeem a card for a specified amount.

FieldRequiredNotes
NumberYesThe gift card number to redeem
AmountYesThe amount to redeem
PINNoThe card's PIN, if your program uses them
CurrencyNoOnly needed if the card's currency differs from your store's default

Returns whether the redemption succeeded.

Redeem card takes money from a card

Unlike the other pieces of Cardigan documented here, this action debits a customer's gift card directly, outside the normal checkout flow.

Build and test these workflows against a staging store using a Bogus profile before enabling them against production credentials.

Add credit to wallet

Adds funds to a customer's wallet in your external system, then synchronises their Shopify store credit balance so the funds are spendable at checkout straight away. Requires a wallet profile - see Wallets.

FieldRequiredNotes
CustomerYesThe customer whose wallet to credit. Both the customer ID and the customer GID are accepted
AmountYesThe amount to add to the wallet
CurrencyYesThe currency of the wallet to credit, as an ISO-4217 code

Returns whether the load succeeded, and the customer's balance afterwards.

Flow retries an action when it doesn't get a success response, so Cardigan recognises a retried run and won't load the funds a second time. Two separate runs of the same workflow are two loads, though - that's your workflow firing twice, not a retry - so build your conditions with that in mind.

Add credit to wallet gives customers money

This action moves real funds into a customer's wallet, outside any order or refund. Test your workflow's conditions carefully before enabling it against production credentials, particularly if it's triggered by something that can fire more often than you expect.

Example workflows

Provision cards after a manual check

If you've set your provisioning trigger to fire on an order tag, Flow is what applies that tag.

Build a workflow triggered by Shopify's Order created trigger, add whatever checks your business requires - an order value threshold, a fraud analysis condition, a wait step, an approval via an external system - and finish with Shopify's Add order tags action applying your configured trigger tag.

Cardigan sees the tag and provisions the cards. This lets you gate gift card issuance behind any workflow you can express in Flow.

Alert your team when a card fails to provision

Trigger on Issued card status changed, add a condition that the new status is failed, and finish with a Slack message or email containing the card's recipient details and the failure message.

This complements Cardigan's own notifications, which are batched hourly - use Flow when you want a specific failure surfaced immediately, or routed somewhere other than email.

Follow up with a customer when their card is ready

Trigger on Issued card status changed, condition on the new status being provisioned and the card type being digital, and send a follow-up message to the recipient.

Useful where you want your own branded communication alongside the delivery your provider sends, particularly for scheduled cards that arrive some time after the original order.

Check a balance during a support workflow

Use the Get card balance action inside a workflow triggered by something in your own systems - a support ticket tag, a scheduled check on outstanding corporate cards - and route the result wherever your team will see it.

Enabling triggers

Cardigan's triggers only send events once you have a Flow workflow using them.

Shopify notifies Cardigan when a workflow using one of its triggers is enabled or disabled, and Cardigan starts or stops emitting the relevant events accordingly. There's nothing to configure in Cardigan itself - build the workflow in Flow, turn it on, and events start arriving.

Previous
Balance check