{ "name": "Create a Paddle Checkout Discount", "nodes": [ { "name": "On clicking 'execute'", "type": "n8n-nodes-base.manualTrigger", "position": [ 550, 260 ], "parameters": {}, "typeVersion": 1, "id": "create-a-paddle-checkout-discount-0" }, { "name": "Prepare the discount", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForEachItem", "jsCode": "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\nreturn {json:paddleDiscount({code:'YOURCODE'}).body};" }, "id": "create-a-paddle-checkout-discount-1" }, { "name": "Create the discount", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "parameters": { "method": "POST", "url": "https://api.paddle.com/discounts", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "contentType": "json", "specifyBody": "json", "jsonBody": "={{ $json }}", "options": {} }, "id": "create-a-paddle-checkout-discount-2" } ], "active": false, "settings": {}, "connections": { "On clicking 'execute'": { "main": [ [ { "node": "Prepare the discount", "type": "main", "index": 0 } ] ] }, "Prepare the discount": { "main": [ [ { "node": "Create the discount", "type": "main", "index": 0 } ] ] } }, "pinData": {} }