POST
/
flows
/
{flow}
/
actions
/
{action}
/
rules

This endpoint requires the flows.write scope.

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

flow
enum<string>
required

The flow name. This can be one of the following.

  • checkout - Applies during checkout to determine what payment options are shown.
  • card-transaction - Applies when processing a card transaction.
  • non-card-transaction - Applies when processing a gift card only transaction, or a redirect transaction using the decline-early action.
  • redirect-transaction - Applies when processing any other transaction.
Available options:
checkout,
card-transaction,
non-card-transaction,
redirect-transaction
action
enum<string>
required

The flow action.

Available options:
select-payment-options,
decline-early,
route-transaction,
skip-3ds

Body

application/json

A request to create a flow rule.

description
string

Description of the flow rule.

Required string length: 1 - 200
conditions
object[]

One or more conditions that apply for this rule. Each condition needs to match for this rule to go into effect.

outcome
object

Defines the outcome of a rule in a flow where the result is a boolean.

error_code
string | null

A custom error code returned when this rule is triggered. This only applies to "decline-early" rule actions. The value must have a flow_ prefix.

Required string length: 1 - 255

Response

201 - application/json
type
enum<string>

The type of this resource. Is always rule.

Available options:
rule
id
string

The unique Gr4vy ID for this rule.

merchant_account_id
string

The unique ID for a merchant account.

description
string | null

Description of the flow rule.

Required string length: 1 - 200
flow
enum<string>

The name of the Flow.

Available options:
checkout,
card-transaction,
non-card-transaction,
redirect-transaction
action
enum<string>

Action for the given rule. Actions can only be used in flows that support them.

  • The checkout flow only supports the select-payment-options action.
  • The card-transaction supports the route-transaction, skip-3ds, and decline-early actions.
  • The non-card-transaction flow only supports the decline-early action.
  • The redirect-transaction flow only supports the route-transaction action.
Available options:
select-payment-options,
decline-early,
route-transaction,
skip-3ds
conditions
object[]

One or more conditions that apply for this rule. Each condition needs to match for this rule to go into effect.

outcome
object

Defines the outcome of a rule in a flow where the result is a list of dictionaries that define the payment service, instrument and transformation to be used to process a transaction.

position
number

The position of the rule in the flow.

created_at
string

The date and time when this buyer was created in our system.

updated_at
string

The date and time when this buyer was last updated in our system.

error_code
string | null

A custom error code returned when this rule is triggered. This only applies to "decline-early" rule actions. The value must have a flow_ prefix.

Required string length: 1 - 255