Integration Stripe/Salesforce

Bonjour,

Je veux des exemples de workflow pour la creation des Invoices/InvoiceItems sur Stripe. Stripe Api

Workflow:

{
  "nodes": [
    {
      "parameters": {
        "authentication": "basicAuth",
        "httpMethod": "POST",
        "path": "c8ec18c1-22ce-436c-bea2-851335999f53",
        "responseMode": "lastNode",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        20,
        540
      ],
      "webhookId": "c8ec18c1-22ce-436c-bea2-851335999f53",
      "credentials": {
        "httpBasicAuth": {
          "id": "8",
          "name": "SF"
        }
      }
    },
    {
      "parameters": {
        "resource": "search",
        "query": "=Select Id,\nsfcma__Amount__c,\nsfcma__Closed__c,\nCurrencyIsoCode,\nsfcma__EndDate__c,\nsfcma__IsPaid__c,\nsfcma__StartDate__c,\nsfcma__StripeInvoiceIdUnique__c,\nLastModifiedDate,\nQuoteId__c,\nCustomer__c,\nCustomer__r.Stripe_ID__c,\nContact__c,\nContact__r.Name,\nContact__r.Email,\nContact__r.Phone,\nStripe_Last_Execution_Date__c,\nsfcma__Subtotal__c,\n(\nSelect Id,\nName,\nCurrencyIsoCode,\nsfcma__Amount__c,\nProduct2Id__c,\nsfcma__Description__c,\nsfcma__Invoice__c,\nsfcma__Quantity__c,\nsfcma__EndDate__c,\nsfcma__StartDate__c,\nsfcma__StripeInvoiceItemIdUnique__c,\nsfcma__Type__c,\nLastModifiedDate,\nStripe_Last_Execution_Date__c,\nProduct2Id__r.Stripe_ID__c,\nStripe_Price_ID__c\nFrom sfcma__InvoiceItems__r\n)\nFrom sfcma__Invoice__c \nWhere Id= '{{$node[\"Webhook\"].json[\"body\"][\"InvoiceId\"]}}'"
      },
      "name": "Get InvoiceItemLines",
      "type": "n8n-nodes-base.salesforce",
      "typeVersion": 1,
      "position": [
        200,
        540
      ],
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "7",
          "name": "Salesforce account"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "return [{\n    json: {\n      //object: \"invoice\",\n      //amount_due: $node[\"Get InvoiceItemLines\"].json.sfcma__Amount__c,\n      //amount_paid: 0,\n      //amount_remaining: null,\n      currency: $node[\"Get InvoiceItemLines\"].json.CurrencyIsoCode,\n      customer: $node[\"Get InvoiceItemLines\"].json.Customer__r.Stripe_ID__c,\n      /*customer_address: null,\n      customer_email: $node[\"Get InvoiceItemLines\"].json.Contact__r.Email,\n      customer_name: $node[\"Get InvoiceItemLines\"].json.Contact__r.Name,\n      customer_phone: $node[\"Get InvoiceItemLines\"].json.Contact__r.Phone,\n      default_payment_method: null,\n      due_date: null,*/\n      lines : $node[\"Get InvoiceItemLines\"].json.sfcma__InvoiceItems__r.records.map(item => {\n        return {\n          object: \"list\",\n          data: [\n            {\n              object: \"line_item\",\n              amount: item.sfcma__Amount__c,\n              currency: item.CurrencyIsoCode,\n              //description: item.sfcma__Description__c,\n              metadata: {\n                SF_ID: item.Id\n              },\n              price: {\n                object: \"price\",\n                currency: item.CurrencyIsoCode,\n                metadata: {\n                  SF_ID: \"\"\n                },\n                product: item.Product2Id__r.Stripe_ID__c,\n                unit_amount: \"\",\n                unit_amount_decimal: \"\"\n              },\n              quantity: item.sfcma__Quantity__c,\n              subscription: null,\n              type: \"invoiceitem\"\n            }\n          ]\n        }\n      }),\n      \"metadata\": {\n      \"SF_ID\": $node[\"Get InvoiceItemLines\"].json.Id\n      },\n      //\"paid\": false,\n      /*\"paid_out_of_band\": false,\n      \"payment_settings\": {\n          \"payment_method_options\": null,\n          \"payment_method_types\": null\n      },*/\n      //\"quote\": $node[\"Get InvoiceItemLines\"].json.QuoteId__c,\n      //\"status\": \"draft\",\n      /*\"status_transitions\": {\n          \"finalized_at\": null,\n          \"marked_uncollectible_at\": null,\n          \"paid_at\": null,\n          \"voided_at\": null\n      },\n      \"subtotal\": 0,\n      \"total\": 0*/\n\n    }\n  }]\n"
      },
      "name": "Create JSON-items1",
      "type": "n8n-nodes-base.function",
      "position": [
        380,
        540
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "authentication": "basicAuth",
        "requestMethod": "POST",
        "url": "=https://api.stripe.com/v1/invoices",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "form-urlencoded"
        }
      },
      "name": "Stripe - Invoice - Insert",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        580,
        540
      ],
      "credentials": {
        "httpBasicAuth": {
          "id": "3",
          "name": "Stripe"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Get InvoiceItemLines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get InvoiceItemLines": {
      "main": [
        [
          {
            "node": "Create JSON-items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create JSON-items1": {
      "main": [
        [
          {
            "node": "Stripe - Invoice - Insert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Le résultat de ma fonction en Json

[
{
"currency": "USD",
"customer": "cus_LHyuMeu7k1uijM",
"lines": [
{
"object": "list",
"data": [
{
"object": "line_item",
"amount": 1072.5,
"currency": "USD",
"description": null,
"metadata": {
"SF_ID": "a0K3J000000BJbfUAG"
},
"price": {
"object": "price",
"currency": "USD",
"metadata": {
"SF_ID": ""
},
"product": "prod_LIS1Qmmneqrj7u",
"unit_amount": "",
"unit_amount_decimal": ""
},
"quantity": 10,
"subscription": null,
"type": "invoiceitem"
}
]
},
{
"object": "list",
"data": [
{
"object": "line_item",
"amount": 3000,
"currency": "USD",
"description": null,
"metadata": {
"SF_ID": "a0K3J000000BJbgUAG"
},
"price": {
"object": "price",
"currency": "USD",
"metadata": {
"SF_ID": ""
},
"product": "prod_LIS18uO1163d4O",
"unit_amount": "",
"unit_amount_decimal": ""
},
"quantity": 10,
"subscription": null,
"type": "invoiceitem"
}
]
}
],
"metadata": {
"SF_ID": "a0L3J000002WfMHUA0"
}
}
]


Quelqu’un peut m’aider S’il vous plaît?