curl --request GET \
--url https://api.staging.payrails.io/merchant/workflows/{workflowCode} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.staging.payrails.io/merchant/workflows/{workflowCode}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.staging.payrails.io/merchant/workflows/{workflowCode}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.staging.payrails.io/merchant/workflows/{workflowCode}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.staging.payrails.io/merchant/workflows/{workflowCode}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.staging.payrails.io/merchant/workflows/{workflowCode}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.payrails.io/merchant/workflows/{workflowCode}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"links": {
"self": "https://api.staging.payrails.io/merchant/rulesets?page[after]=qf7pnbyfrr&page[size]=2",
"prev": "https://api.staging.payrails.io/merchant/rulesets?page[before]=hbe66nh8i8&page[size]=2",
"next": "https://api.staging.payrails.io/merchant/rulesets?page[after]=xk2h55zsy5&page[size]=2",
"first": "https://api.staging.payrails.io/merchant/rulesets?page[size]=2",
"last": "https://api.staging.payrails.io/merchant/rulesets?page[before]=9wkueqcavq&page[size]=2"
},
"results": [
{
"createdAt": "2020-06-30T14:00:00.000Z",
"workflowCode": "payment-acceptance",
"workspaceId": "7f9f1882-a103-408d-ac96-46a7021e537a",
"version": 3,
"description": "Workflow configuration description.",
"archived": false,
"config": {
"workspaceId": "7f9f1882-a103-408d-ac96-46a7021e537a",
"global": {
"notifications": {
"targets": [
{
"destination": "https://test.com",
"enabledEventTypes": [
"executionActionCompleted"
]
},
{
"destination": "https://test2.com",
"enabledEventTypes": [
"executionActionCompleted",
"networkOffersEnrollmentCompleted"
]
}
]
}
},
"lookup": {
"paymentOptions": {
"rulesets": [
{
"id": "0b5de15b-7871-4779-be08-8e6e00ed70d3",
"version": 4
}
]
}
},
"authorize": {
"settings": {
"staticConfigs": {
"captureMode": {
"type": "setCaptureMode",
"params": {
"mode": "Delayed"
}
},
"captureDelay": {
"type": "setDelay",
"params": {
"delay": "PT24H"
}
},
"instrumentFutureUsage": {
"type": "setFutureUsage",
"params": {
"futureUsage": "CardOnFile"
}
},
"expiration": {
"type": "setDelay",
"params": {
"delay": "PT1H"
}
}
}
},
"providerOptions": {
"rulesets": [
{
"id": "1f3cb3c4-3d8d-4f3c-94ad-30a0a17fde6d",
"version": 1
}
]
}
},
"startPaymentSession": {
"providerOptions": {
"rulesets": [
{
"id": "1f3cb3c4-3d8d-4f3c-94ad-30a0a17fde6d",
"version": 1
}
]
}
},
"steps": [
{
"name": "Start authorize",
"code": "triggerAuthorize",
"type": "trigger",
"params": {
"type": "clientAPI",
"params": {
"path": "/authorize",
"method": "POST"
},
"requestMapping": [
{
"from": "meta",
"to": "notify.meta"
}
],
"responseMapping": [
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
},
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "createInstrument",
"mapping": [
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.cardData.createdAt",
"to": "token.meta.createdAt"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.cardData.numberToken",
"to": "token.meta.cardNumber"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.vaultToken",
"to": "token.reference"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentId",
"to": "id"
},
{
"from": "output.authorize.paymentComposition[0].paymentMethodCode",
"to": "paymentMethod"
},
{
"from": "output.authorize.paymentComposition[0].storeInstrument",
"to": "storeInstrument"
},
{
"from": "output.authorize.scope",
"to": "scope"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.cardData.securityCodeToken",
"to": "token.meta.securityCode"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.encryptedData",
"to": "data.encryptedData"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.vaultProviderConfigId",
"to": "token.providerConfigId"
}
]
}
}
]
}
},
{
"name": "Create or Get Instrument",
"code": "createInstrument",
"type": "action",
"params": {
"type": "createInstrument",
"nextActions": {
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "authorizeCardDefault",
"mapping": [
{
"from": "output.id",
"to": "paymentComposition[0].paymentInstrumentId"
}
]
}
}
]
}
}
},
{
"name": "Authorize Payment (Default 3DS)",
"code": "authorizeCardDefault",
"type": "action",
"params": {
"type": "authorize",
"settings": {
"threeDSMode": "Default",
"instantCapture": true,
"instrumentCreationDisabled": true
},
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizeRequested"
}
}
],
"onPaused": [
{
"type": "addNextStep",
"params": {
"code": "checkAuthPendingReason"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkAuthorizeResult"
}
}
]
}
}
},
{
"name": "Check authorize result",
"code": "checkAuthorizeResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizeSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizeFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Send pending notification to merchant",
"code": "sendPendingNotification",
"type": "action",
"params": {
"type": "notify",
"settings": {
"eventType": "executionActionPending"
},
"nextActions": {}
}
},
{
"name": "Start Capture",
"code": "triggerCapture",
"type": "trigger",
"params": {
"type": "merchantAPI",
"params": {
"path": "/capture",
"method": "POST"
},
"responseMapping": [
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
},
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "capture"
}
}
]
}
},
{
"name": "Capture",
"code": "capture",
"type": "action",
"params": {
"type": "capture",
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "captureRequested"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkCaptureResult"
}
}
]
}
}
},
{
"name": "Check capture result",
"code": "checkCaptureResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "captureSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "captureFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Start cancel",
"code": "triggerCancel",
"type": "trigger",
"params": {
"type": "merchantAPI",
"params": {
"path": "/cancel",
"method": "POST"
},
"responseMapping": [
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
},
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "cancel"
}
}
]
}
},
{
"name": "Cancel",
"code": "cancel",
"type": "action",
"params": {
"type": "cancel",
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "cancelRequested"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkCancelResult"
}
}
]
}
}
},
{
"name": "Check cancel result",
"code": "checkCancelResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "cancelSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "cancelFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Start Refund",
"code": "triggerRefund",
"type": "trigger",
"params": {
"type": "merchantAPI",
"params": {
"path": "/refund",
"method": "POST"
},
"responseMapping": [
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
},
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "refund"
}
}
]
}
},
{
"name": "Refund",
"code": "refund",
"type": "action",
"params": {
"type": "refund",
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "refundRequested"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkRefundResult"
}
}
]
}
}
},
{
"name": "Check refund result",
"code": "checkRefundResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "refundSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "refundFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Send notification to merchant",
"code": "sendNotification",
"type": "action",
"params": {
"type": "notify",
"nextActions": {}
}
},
{
"name": "Check pending reason",
"code": "checkAuthPendingReason",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "output.reason",
"operator": "=",
"value": "actionRequired"
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizePending"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendPendingNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
]
}
}
],
"description": "Workflow configuration description."
},
"setAsDefaultBy": "john.doe@payrails.com",
"setAsDefaultAt": "2020-06-30T14:00:00.000Z",
"versions": [
{
"version": 3,
"weight": 80
},
{
"version": 2,
"weight": 20
}
]
},
{
"createdAt": "2020-06-29T14:00:00.000Z",
"workflowCode": "payment-acceptance",
"workspaceId": "7f9f1882-a103-408d-ac96-46a7021e537a",
"version": 2,
"archived": false,
"config": {
"lookup": {
"paymentOptions": {
"rulesets": [
{
"id": "0b5de15b-7871-4779-be08-8e6e00ed70d3",
"version": 3
},
{
"id": "5befb9dd-b481-47a1-bb67-c5c7ef16204f",
"version": 1
}
]
}
},
"authorize": {
"settings": {
"staticConfigs": {
"authorizationType": {
"type": "setCaptureMode",
"params": {
"mode": "Delayed"
}
},
"captureDelay": {
"type": "setDelay",
"params": {
"delay": "PT5M"
}
}
}
}
}
}
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.unauthorized",
"detail": "The request lacks necessary credentials to perform the specified action",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestunauthorized"
}
]
}{
"errors": [
{
"id": "e7db22b3-914e-4975-928e-9edfb0885bea",
"code": "request.forbidden",
"detail": "The request credentials lack the required permissions to perform the specified action",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestforbidden"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.rate-limit",
"detail": "Too many requests",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestrate-limit"
}
]
}Search & list workflow configurations
Fetch a list of workflow configuration versions for the given workflow code and query parameters.
curl --request GET \
--url https://api.staging.payrails.io/merchant/workflows/{workflowCode} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.staging.payrails.io/merchant/workflows/{workflowCode}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.staging.payrails.io/merchant/workflows/{workflowCode}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.staging.payrails.io/merchant/workflows/{workflowCode}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.staging.payrails.io/merchant/workflows/{workflowCode}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.staging.payrails.io/merchant/workflows/{workflowCode}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.payrails.io/merchant/workflows/{workflowCode}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"links": {
"self": "https://api.staging.payrails.io/merchant/rulesets?page[after]=qf7pnbyfrr&page[size]=2",
"prev": "https://api.staging.payrails.io/merchant/rulesets?page[before]=hbe66nh8i8&page[size]=2",
"next": "https://api.staging.payrails.io/merchant/rulesets?page[after]=xk2h55zsy5&page[size]=2",
"first": "https://api.staging.payrails.io/merchant/rulesets?page[size]=2",
"last": "https://api.staging.payrails.io/merchant/rulesets?page[before]=9wkueqcavq&page[size]=2"
},
"results": [
{
"createdAt": "2020-06-30T14:00:00.000Z",
"workflowCode": "payment-acceptance",
"workspaceId": "7f9f1882-a103-408d-ac96-46a7021e537a",
"version": 3,
"description": "Workflow configuration description.",
"archived": false,
"config": {
"workspaceId": "7f9f1882-a103-408d-ac96-46a7021e537a",
"global": {
"notifications": {
"targets": [
{
"destination": "https://test.com",
"enabledEventTypes": [
"executionActionCompleted"
]
},
{
"destination": "https://test2.com",
"enabledEventTypes": [
"executionActionCompleted",
"networkOffersEnrollmentCompleted"
]
}
]
}
},
"lookup": {
"paymentOptions": {
"rulesets": [
{
"id": "0b5de15b-7871-4779-be08-8e6e00ed70d3",
"version": 4
}
]
}
},
"authorize": {
"settings": {
"staticConfigs": {
"captureMode": {
"type": "setCaptureMode",
"params": {
"mode": "Delayed"
}
},
"captureDelay": {
"type": "setDelay",
"params": {
"delay": "PT24H"
}
},
"instrumentFutureUsage": {
"type": "setFutureUsage",
"params": {
"futureUsage": "CardOnFile"
}
},
"expiration": {
"type": "setDelay",
"params": {
"delay": "PT1H"
}
}
}
},
"providerOptions": {
"rulesets": [
{
"id": "1f3cb3c4-3d8d-4f3c-94ad-30a0a17fde6d",
"version": 1
}
]
}
},
"startPaymentSession": {
"providerOptions": {
"rulesets": [
{
"id": "1f3cb3c4-3d8d-4f3c-94ad-30a0a17fde6d",
"version": 1
}
]
}
},
"steps": [
{
"name": "Start authorize",
"code": "triggerAuthorize",
"type": "trigger",
"params": {
"type": "clientAPI",
"params": {
"path": "/authorize",
"method": "POST"
},
"requestMapping": [
{
"from": "meta",
"to": "notify.meta"
}
],
"responseMapping": [
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
},
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "createInstrument",
"mapping": [
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.cardData.createdAt",
"to": "token.meta.createdAt"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.cardData.numberToken",
"to": "token.meta.cardNumber"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.vaultToken",
"to": "token.reference"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentId",
"to": "id"
},
{
"from": "output.authorize.paymentComposition[0].paymentMethodCode",
"to": "paymentMethod"
},
{
"from": "output.authorize.paymentComposition[0].storeInstrument",
"to": "storeInstrument"
},
{
"from": "output.authorize.scope",
"to": "scope"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.cardData.securityCodeToken",
"to": "token.meta.securityCode"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.encryptedData",
"to": "data.encryptedData"
},
{
"from": "output.authorize.paymentComposition[0].paymentInstrumentData.vaultProviderConfigId",
"to": "token.providerConfigId"
}
]
}
}
]
}
},
{
"name": "Create or Get Instrument",
"code": "createInstrument",
"type": "action",
"params": {
"type": "createInstrument",
"nextActions": {
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "authorizeCardDefault",
"mapping": [
{
"from": "output.id",
"to": "paymentComposition[0].paymentInstrumentId"
}
]
}
}
]
}
}
},
{
"name": "Authorize Payment (Default 3DS)",
"code": "authorizeCardDefault",
"type": "action",
"params": {
"type": "authorize",
"settings": {
"threeDSMode": "Default",
"instantCapture": true,
"instrumentCreationDisabled": true
},
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizeRequested"
}
}
],
"onPaused": [
{
"type": "addNextStep",
"params": {
"code": "checkAuthPendingReason"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkAuthorizeResult"
}
}
]
}
}
},
{
"name": "Check authorize result",
"code": "checkAuthorizeResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizeSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizeFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Send pending notification to merchant",
"code": "sendPendingNotification",
"type": "action",
"params": {
"type": "notify",
"settings": {
"eventType": "executionActionPending"
},
"nextActions": {}
}
},
{
"name": "Start Capture",
"code": "triggerCapture",
"type": "trigger",
"params": {
"type": "merchantAPI",
"params": {
"path": "/capture",
"method": "POST"
},
"responseMapping": [
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
},
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "capture"
}
}
]
}
},
{
"name": "Capture",
"code": "capture",
"type": "action",
"params": {
"type": "capture",
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "captureRequested"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkCaptureResult"
}
}
]
}
}
},
{
"name": "Check capture result",
"code": "checkCaptureResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "captureSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "captureFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Start cancel",
"code": "triggerCancel",
"type": "trigger",
"params": {
"type": "merchantAPI",
"params": {
"path": "/cancel",
"method": "POST"
},
"responseMapping": [
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
},
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "cancel"
}
}
]
}
},
{
"name": "Cancel",
"code": "cancel",
"type": "action",
"params": {
"type": "cancel",
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "cancelRequested"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkCancelResult"
}
}
]
}
}
},
{
"name": "Check cancel result",
"code": "checkCancelResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "cancelSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "cancelFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Start Refund",
"code": "triggerRefund",
"type": "trigger",
"params": {
"type": "merchantAPI",
"params": {
"path": "/refund",
"method": "POST"
},
"responseMapping": [
{
"from": "output.links",
"to": "links"
},
{
"from": "output.workspaceId",
"to": "workspaceId"
},
{
"from": "output.actionId",
"to": "actionId"
},
{
"from": "output.executedAt",
"to": "executedAt"
},
{
"from": "output.name",
"to": "name"
}
],
"nextActions": [
{
"type": "addNextStep",
"params": {
"code": "refund"
}
}
]
}
},
{
"name": "Refund",
"code": "refund",
"type": "action",
"params": {
"type": "refund",
"nextActions": {
"onRequested": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "refundRequested"
}
}
],
"onCompleted": [
{
"type": "addNextStep",
"params": {
"code": "checkRefundResult"
}
}
]
}
}
},
{
"name": "Check refund result",
"code": "checkRefundResult",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "success",
"operator": "=",
"value": true
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "refundSuccessful"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
],
"defaultActions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "refundFailed"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
},
{
"name": "Send notification to merchant",
"code": "sendNotification",
"type": "action",
"params": {
"type": "notify",
"nextActions": {}
}
},
{
"name": "Check pending reason",
"code": "checkAuthPendingReason",
"type": "condition",
"params": {
"rules": [
{
"condition": {
"field": "output.reason",
"operator": "=",
"value": "actionRequired"
},
"actions": [
{
"type": "addWorkflowExecutionStatus",
"params": {
"status": "authorizePending"
}
},
{
"type": "addNextStep",
"params": {
"code": "sendPendingNotification",
"mapping": [
{
"from": "output.eventId",
"to": "eventId"
}
]
}
}
]
}
]
}
}
],
"description": "Workflow configuration description."
},
"setAsDefaultBy": "john.doe@payrails.com",
"setAsDefaultAt": "2020-06-30T14:00:00.000Z",
"versions": [
{
"version": 3,
"weight": 80
},
{
"version": 2,
"weight": 20
}
]
},
{
"createdAt": "2020-06-29T14:00:00.000Z",
"workflowCode": "payment-acceptance",
"workspaceId": "7f9f1882-a103-408d-ac96-46a7021e537a",
"version": 2,
"archived": false,
"config": {
"lookup": {
"paymentOptions": {
"rulesets": [
{
"id": "0b5de15b-7871-4779-be08-8e6e00ed70d3",
"version": 3
},
{
"id": "5befb9dd-b481-47a1-bb67-c5c7ef16204f",
"version": 1
}
]
}
},
"authorize": {
"settings": {
"staticConfigs": {
"authorizationType": {
"type": "setCaptureMode",
"params": {
"mode": "Delayed"
}
},
"captureDelay": {
"type": "setDelay",
"params": {
"delay": "PT5M"
}
}
}
}
}
}
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.unauthorized",
"detail": "The request lacks necessary credentials to perform the specified action",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestunauthorized"
}
]
}{
"errors": [
{
"id": "e7db22b3-914e-4975-928e-9edfb0885bea",
"code": "request.forbidden",
"detail": "The request credentials lack the required permissions to perform the specified action",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestforbidden"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.rate-limit",
"detail": "Too many requests",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestrate-limit"
}
]
}Authorizations
You can use an OAuth2 JWT bearer token in the Authorization header of your API requests for supported endpoints: Authorization: Bearer <YOUR_JWT_HERE>.
These tokens are valid for 10 minutes and can be requested via the access token endpoint endpoint.
Path Parameters
Path parameter to specify the workflow code. Machine-friendly code of Workflow.
^[a-z][-A-Za-z0-9]*$Query Parameters
Search collection items after that cursor. Cursor for paging results.
Search collection items before that cursor. Cursor for paging results.
Length of the collection to search.
Filter by createdAt field using interval notation.
1973-02-03T04:32:11.596Z - exact date value
(1973-02-03T04:32:11.596Z - after the date excluding it
[1973-02-03T04:32:11.596Z - after the date including it
1973-02-03T04:32:11.596Z) - before the date excluding it
1973-02-03T04:32:11.596Z] - before the date including it
(1973-02-03T04:32:11.596Z,1973-04-03T03:20:11.436Z) - between two dates excluding both
(1973-02-03T04:32:11.596Z,1973-04-03T03:20:11.436Z] - between two dates excluding on the left
[1973-02-03T04:32:11.596Z,1973-04-03T03:20:11.436Z) - between two dates excluding on the right
[1973-02-03T04:32:11.596Z,1973-04-03T03:20:11.436Z] - between two dates including both.
"[2026-04-01T00:00:00Z,2026-05-01T00:00:00Z)"
Filter by Workspace ID.
Response
Success.
Hide child attributes
Hide child attributes
Creation date of the workflow configuration.
Machine-friendly code of Workflow.
^[a-z][-A-Za-z0-9]*$Workspace ID that the workflow configuration belongs to.
Version of a Workflow Configuration.
Configuration of the workflow.
Hide child attributes
Hide child attributes
Workspace ID that the workflow configuration belongs to.
Configuration shared between nodes.
Hide child attributes
Hide child attributes
Configuration for notifications sent by workflow nodes.
Hide child attributes
Hide child attributes
Targets where notifications need to be sent.
Hide child attributes
Hide child attributes
URL where notification needs to be sent.
A list of events what need to be sent to the destination. If empty, the destination will be disabled, so no notifications will be sent there.
executionActionCompleted, networkOffersEnrollmentCompleted Workflow steps configuration.
Hide child attributes
Hide child attributes
Defines the type of operation to be executed. Each type has a different set of parameters.
trigger, action, condition A human-readable step name (e.g. Authorization retry with Checkout).
A machine-readable step name (e.g. authorizeRetryWithCheckout).
Set of configuration parameters specific to the step type.
- Action Step Parameters.
- Condition Step Parameters.
- Trigger Step Parameters.
Hide child attributes
Hide child attributes
Type of action (e.g. authorize, createInstrument, etc).
createInstrument, lookup, authorize, capture, cancel, refund, fraudScore, fraudUpdate, notify, payout, smartRouting Settings for a workflow action step, varying by action type.
- Fraud Action Settings
- Authorization Action Settings
- Notification Action Settings
- Smart Routing Action Settings
Hide child attributes
Hide child attributes
UUID of the fraud provider configuration to be used.
Time after the action starts before it is considered expired, in ISO 8601 format (e.g. PT1H for 1 hour).
Specifies next actions executed sequentially in response to lifecycle events of an action.
Hide child attributes
Hide child attributes
- Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode Hide child attributes
Hide child attributes
Capture mode to define if money is captured instantly, with delay or manually.
Instant, Delayed, Manual - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode - Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode Configuration for the lookup node.
Hide child attributes
Hide child attributes
Configuration for a specific step of a workflow node.
- Static node step configuration.
- Rulesets node step configuration.
- Resolved rulesets node step configuration.
Hide child attributes
Hide child attributes
Static configuration of the step.
Hide child attributes
Hide child attributes
- Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode Hide child attributes
Hide child attributes
Capture mode to define if money is captured instantly, with delay or manually.
Instant, Delayed, Manual Configuration for the authorize node.
Hide child attributes
Hide child attributes
Configuration for a specific step of a workflow node.
- Static node step configuration.
- Rulesets node step configuration.
- Resolved rulesets node step configuration.
Hide child attributes
Hide child attributes
Static configuration of the step.
Hide child attributes
Hide child attributes
- Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode Hide child attributes
Hide child attributes
Capture mode to define if money is captured instantly, with delay or manually.
Instant, Delayed, Manual Configuration for a specific step of a workflow node.
- Static node step configuration.
- Rulesets node step configuration.
- Resolved rulesets node step configuration.
Hide child attributes
Hide child attributes
Static configuration of the step.
Hide child attributes
Hide child attributes
- Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode Hide child attributes
Hide child attributes
Capture mode to define if money is captured instantly, with delay or manually.
Instant, Delayed, Manual Configuration for the start payment session node.
Hide child attributes
Hide child attributes
Configuration for a specific step of a workflow node.
- Static node step configuration.
- Rulesets node step configuration.
- Resolved rulesets node step configuration.
Hide child attributes
Hide child attributes
Static configuration of the step.
Hide child attributes
Hide child attributes
- Set capture mode.
- Set cancel mode.
- Set delay.
- Set priority.
- Skip.
- Stop.
- Set instrument future usage.
- Add Next Step.
- Add Workflow Execution Status.
Hide child attributes
Hide child attributes
Set the capture mode.
setCaptureMode Hide child attributes
Hide child attributes
Capture mode to define if money is captured instantly, with delay or manually.
Instant, Delayed, Manual Description for the workflow.
User email. The values are set with the credentials of the request owner.
Description for the workflow.
Whether the workflow version should be displayed archived in Merchant Portal, and filtered from relevant lists. It does not affect write/modify actions, only display behavior.
User email who set this workflow version as default.
Timestamp when this configuration was set as default.
Rollout configuration for traffic splitting between versions. Only populated when fetching the default version.