curl --request PATCH \
--url https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Workflow configuration description."
}
'import requests
url = "https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}"
payload = { "description": "Workflow configuration description." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: 'Workflow configuration description.'})
};
fetch('https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}', 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}/versions/{workflowVersion}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Workflow configuration description.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}"
payload := strings.NewReader("{\n \"description\": \"Workflow configuration description.\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Workflow configuration description.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Workflow configuration description.\"\n}"
response = http.request(request)
puts response.read_body{
"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
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.malformed",
"detail": "The request has malformed syntax",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestmalformed"
}
]
}{
"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.not-found",
"detail": "The requested resource was not found",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestnot-found"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.conflict",
"detail": "The request operation is not allowed due to a conflict with the current state of the resource",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestconflict"
}
]
}{
"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"
}
]
}Updates a workflow configuration version
Updates the description and/or archived attributes of a workflow configuration version. At least one of them must be provided.
curl --request PATCH \
--url https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Workflow configuration description."
}
'import requests
url = "https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}"
payload = { "description": "Workflow configuration description." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: 'Workflow configuration description.'})
};
fetch('https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}', 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}/versions/{workflowVersion}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Workflow configuration description.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}"
payload := strings.NewReader("{\n \"description\": \"Workflow configuration description.\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Workflow configuration description.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.payrails.io/merchant/workflows/{workflowCode}/versions/{workflowVersion}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Workflow configuration description.\"\n}"
response = http.request(request)
puts response.read_body{
"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
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.malformed",
"detail": "The request has malformed syntax",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestmalformed"
}
]
}{
"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.not-found",
"detail": "The requested resource was not found",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestnot-found"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.conflict",
"detail": "The request operation is not allowed due to a conflict with the current state of the resource",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestconflict"
}
]
}{
"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]*$Path parameter to specify the workflow version. Workflow configuration version.
Body
- Option 1
- Option 2
Description for the workflow configuration. Omit or set to null to leave the description unchanged.
Workspace ID that the workflow configuration belongs to.
Whether the workflow version should be displayed archived in Merchant Portal. Omit or set to null to leave archived unchanged.
Response
Created.
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 - 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 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 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.