Using rules with our Webservices API

  Last updated: 

 

  The following content assumes you have obtained the necessary PCI certification to process and submit sensitive cardholder data in the request to our Webservices API.
Read this article to learn more.

Rules can be activated for individual JSON requests by submitting the unique rule identifier in the ruleidentifier field. Rules specified in the JSON request will instruct our system to perform certain actions if pre-defined criteria are met (regardless of whether the rules have been set to active in MyST). The following is an example request where two rules STR-1 and UDR-23 are specified:

Python PHP cURL
#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "webservices@example.com"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

auth = {
"sitereference": "test_site12345",
"requesttypedescriptions": ["AUTH"],
"accounttypedescription": "ECOM",
"currencyiso3a": "GBP",
"baseamount": "1050",
"orderreference": "My_Order_123",
"pan": "4111111111111111",
"expirydate": "12/2020",
"securitycode": "123",
"ruleidentifier": ["STR-1","UDR-23"]
}

strequest = securetrading.Request()
strequest.update(auth)
stresponse = st.process(strequest) #stresponse contains the transaction response

  Rules cannot be inherited in child requests.

 

Field specification

  Field Format Description
table-optional.png ruleidentifier
XPath: /operation/rule/@identifier
Alphanumeric including hyphens As shown in the example request above, you can submit unique identifiers for rules to be applied to this request (e.g. STR-1).

 

Was the action performed?

If a rule was applied to a request and the criteria specified in the condition were met, resulting in the action being triggered, the response contains additional fields to confirm this has taken place. Please refer to the example response below, where two rules were applied and their actions were performed.

  If a condition is not met, the action will not be performed and no additional fields will be returned in the response.

Python PHP cURL
{
u 'requestreference': u 'A0bxh87wt',
u 'version': u '1.00',
u 'response': [{
u 'transactionstartedtimestamp': u '2016-12-07 11:32:44',

#### OTHER FIELDS NORMALLY RETURNED IN AUTH RESPONSE ####

u 'rules': [{
u 'ruleidentifier': u 'STR-1',
u 'ruledescription': u 'Auth security code not matched - Merchant decline'
}, {
u 'ruleidentifier': u 'UDR-23',
u 'ruledescription': u 'successful Visa AUTH - server 1'
}],
}]
}
  Field Format Description
table-conditional.png rules
XPath: /operation/rule/@identifier
 

If any actions were performed, rules is returned in the response JWT.

This contains information for each rule where an action was performed.

table-conditional.png ruleidentifier
XPath: /operation/rule/@identifier
Alphanumeric including hyphens

For each rule where action was performed, the unique rule identifier (e.g. STR-1) will be returned in the response JWT.

Always returned if an action has been triggered, otherwise not returned.

table-conditional.png ruledescription
XPath: /operation/rule/@identifier
Alphanumeric For each rule where action was performed, the rule description will be returned in the response JWT. This consists of the condition name and action name in a string, both separated with a hyphen, as shown in the response example above.
Was this article helpful?
0 out of 0 found this helpful