Account Rules

Account rules allow you to block transactions using captured merchant information. Shaype's Rules Engine provides bespoke management of what types of transaction are blocked for a selected account. This can be defined on a per account or per product basis.

Clients are allow to define the transaction blocking rules, disable rules and retrieve the rule details.

📘

If there are multiple rules that apply to a transaction, the transaction will be blocked by the first matching rule and return only that reason in the notification.

APIs

Create Rule for Account

  • This endpoint is designed to allow account-level controls over how money can be spent.
  • Following are the supported features:
    • Block a transaction based on Merchant Category Code (MCC) or Merchant Id: User can’t spend money at certain businesses - eg alcohol stores, gambling etc. Use ruleType MERCHANT_CODE_BLOCK or MERCHANT_ID_BLOCK
      You can use the endpoint https://developer.shaype.com/reference/getallmerchantcategorycodes to retrieve MCC codes.
    • Block a transaction based on Merchant Name: User can’t spend money at a particular business. Use ruleType MERCHANT_NAME_BLOCK
    • Set a rule for a timed period: User spending is restricted for a specified time period - eg no alcohol for the next 3 days
  • You will receive the notification with the ruleDetails under type TRANSACTION on rule failed.

API Reference: Create Rule for Account


Get Rule for Account by Rule Id

  • This endpoint is used to retrieve specific rule details from account.

API Reference: Get Rule for Account by Rule ID


Get All Rules of Account

  • This endpoint is used to retrieve all a rules associated with the specific account.

API Reference: Get all Rules by Account ID


Delete Rule from Account

  • This endpoint is used to delete a rule from an account.

API Reference: Delete Rule from Account


Webhook Notification

The Shaype platform will notify clients when a transaction is blocked based on defined rules. You will receive ruleDetails object with outcome:REFUSED_RULES

{
  "customerHayId": "8e4e6d96-d7d4-4165-a626-24daac61fbf7",
  "idempotencyKey": "b5c1f4ba-847a-403c-96eb-f305cbfa24da",
  "type": "TRANSACTION",
  "productId": "8aa686b7-7c36-e802-017c-f305cbfa24da",
  "transactionEvent": {
    "transactionHayId": "e7e524c9-ef51-448d-bd02-24daac61fbf7",
    "holdHayId": "e7e524c9-ef51-448d-bd02-24daac61fbf7",
    "accountHayId": "23334fc0-1b7a-4817-a8fe-24daac61fbf7",
    "currencyAmount": {
      "currency": "AUD",
      "amount": 20.00
    },
    "updatedBalance": {
      "currency": "AUD",
      "amount": 999.5800000000
    },
    "isPending": true,
    "counterpartName": "GOOGLE *TEMPORARY HOLD",
    "outcome": "REFUSED_RULES",
    "transactionTimeUtc": "2022-03-03T16:31:11.020996Z",
    "cardPreferenceOutcome": "OK",
    "isAtmTransaction": false,
    "transactionType": "CARD_TRANSACTION",
    "cardUsageDetails": {
      "isMagneticStripePayment": false,
      "isContactless": false,
      "isCardPresent": false,
      "isMobileWalletPayment": false,
      "isAtmWithdrawal": false
    },
    "accountBalances": {
      "totalBalance": {
        "currency": "AUD",
        "amount": 999.5800000000
      },
      "heldBalance": {
        "currency": "AUD",
        "amount": 0
      },
      "lockedBalance": {
        "currency": "AUD",
        "amount": 0
      },
      "stacksBalance": {
        "currency": "AUD",
        "amount": 0
      },
      "availableBalance": {
        "currency": "AUD",
        "amount": 999.5800000000
      }
    },
    "cardHayId": "afb006d4-cbdb-4ca4-86e9-24daac61fbf7",
    "customerHayId": "8e4e6d96-d7d4-4165-a626-24daac61fbf7",
    "ruleDetails": {
      "ruleId": "f305cbfa-63db-4083-8819-24daac61fbf7"
    },
    "category": "SHOPPING",
    "description": "Whisky from BWS"
  }
}