{ "kind": "open-flow-workflow", "version": 1, "name": "Create a PayPal Payout Batch", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_b74e80ae73d48bbb": { "name": "Enter payout items", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "minItems": 1 }, "nullable": false, "handle": "items" } ] }, "n_69d344db75dedc4f": { "inputs": { "batchId": { "kind": "value", "value": "123" }, "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b74e80ae73d48bbb", "output": "items" } ] } }, "name": "Prepare payout batch", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "batchId" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "minItems": 1 }, "nullable": false, "handle": "items" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Prepare payout batch", "moduleId": "n_1e75a3a7b40fce70", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_d73ece96af598a37": { "inputs": { "endpoint": { "kind": "value", "value": "https://api-m.sandbox.paypal.com/v1/payments/payouts" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_69d344db75dedc4f", "output": "body" } ] } }, "name": "Submit payout", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Submit payout", "executor": { "providerId": "paypal", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_c691dbfbdbf6c0a4": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d73ece96af598a37", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d73ece96af598a37", "output": "statusCode" } ] } }, "name": "Check response", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "result" } ], "name": "Check response", "moduleId": "n_0d09d70c635b05c3", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_bf8e2ab85891b00b": { "name": "Payout response", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "result" } ], "outputMappings": { "result": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c691dbfbdbf6c0a4", "output": "result" } ] } } } }, "edges": [ { "source": "n_b74e80ae73d48bbb", "target": "n_69d344db75dedc4f" }, { "source": "n_69d344db75dedc4f", "target": "n_d73ece96af598a37" }, { "source": "n_d73ece96af598a37", "target": "n_c691dbfbdbf6c0a4" }, { "source": "n_c691dbfbdbf6c0a4", "target": "n_bf8e2ab85891b00b" } ] } }, "modules": { "n_1e75a3a7b40fce70": { "name": "Prepare payout batch", "imports": [], "source": "export default function payout({batchId,items}) {if(!batchId||!Array.isArray(items)||!items.length)throw Error('Provide a batch ID and at least one payout item');return {body:{sender_batch_header:{sender_batch_id:batchId},items}}}\n" }, "n_0d09d70c635b05c3": { "name": "Check response", "imports": [], "source": "export default function result({body,statusCode}) {if(statusCode<200||statusCode>=300)throw Error('Payout request failed or is uncertain; inspect PayPal before retrying');return {result:body}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }