google-apps-scriptstripesstripe-payments

Send Invoice to Email Stripe (Google App Scir


Hi guys I am having trouble sending an invoice due to

parameter_invalid_integer

this error.

Here's my code of sending

var url3 = "https://api.stripe.com/v1/invoices";
      var params3 = {
      method: "post",
      headers: {Authorization: "Basic " + Utilities.base64Encode("sk_test_XXXXX:")},
      payload: 
      {
        customer: responseValue.id,
        collection_method : "send_invoice",
        due_date:responseValue2.date
      }
    };
    var res3 = UrlFetchApp.fetch(url3, params3);
    Logger.log(res3.getContentText());

the due_date is the problem because I can't give its format . The documentation didn't provide any of that or I am just dumb that I can't understand it.

I tried

due_date:Date.now()
due_date:"01/01/2022" // tried different formats

What I am trying to do is that I am trying to send the invoice base on the email address provided on the invoice.

Please enlighten me . Thank you.

#TRIED 1

var timeStamp = (new Date('2022-01-01').getTime())/1000;
due_date = timeStamp

still the same error


Solution

  • Solved it . What I did was

    var timeStamp = (new Date('2021-08-10').getTime())/1000;
    due_date: ""+timeStamp+""
    

    Thanks everyone.