{ "kind": "open-flow-workflow", "version": 1, "name": "Create a Paddle Checkout Discount", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_dab7a33adfc7ca33": { "name": "Start on demand", "kind": "start", "inputDefs": [] }, "n_58cb35791c62ff34": { "inputs": { "code": { "kind": "value", "value": "YOURCODE" } }, "name": "Prepare the discount", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "code" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Prepare the discount", "moduleId": "n_80cb1ba9d1e0137e", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_02afe7c4f5f02658": { "inputs": { "endpoint": { "kind": "value", "value": "/discounts" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_58cb35791c62ff34", "output": "body" } ] } }, "name": "Create the discount", "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": "Create the discount", "executor": { "providerId": "paddle", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } } }, "edges": [ { "source": "n_dab7a33adfc7ca33", "target": "n_58cb35791c62ff34" }, { "source": "n_58cb35791c62ff34", "target": "n_02afe7c4f5f02658" } ] } }, "modules": { "n_80cb1ba9d1e0137e": { "name": "Prepare the discount", "imports": [], "source": "export default function paddleDiscount({code}) {\n if(typeof code!=='string'||! /^[A-Za-z0-9]{1,32}$/.test(code)||code==='YOURCODE')throw Error('Set a unique Paddle discount code using letters and numbers');\n return {body:{description:'EUR 2 checkout discount',type:'flat',amount:'200',currency_code:'EUR',enabled_for_checkout:true,code,recur:false}};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }