Stripe Card Registration

Registers customer's settlement information to Stripe and stores the Customer ID and the last 4 digits of credit card number to be used for billing, the status of registration processing, and the communication log into the data items respectively

    A. Set SecretKey for Stripe Access (sk_xxx: 32 letters)Single-line inputRequired
    B. Select STRING/SELECT DATA for Description (e.g. Corp Name)Data selectString(single line)orSelect(radio/select/search)
    C. Select STRING DATA for EmailData selectString(single line)
    D. Select STRING/SELECT DATA for ExpMonth (e.g. "02")Data selectString(single line)orSelect(radio/select/search)Required
    E. Select STRING/SELECT DATA for ExpYear (e.g. "2018")Data selectString(single line)orSelect(radio/select/search)Required
    F. Select STRING DATA for CardNumber (without any separators)Data selectString(single line)Required
    G. Select STRING DATA for CVCData selectString(single line)Required
    H. Select STRING DATA for Cardholder's NameData selectString(single line)
    I. Select STRING DATA for Customer ID on Stripe (update)Data selectString(single line)
    J. Select STRING DATA for Last4 of CardNumber (update)Data selectString(single line)
    W. Select STRING DATA for Status Code Log (update)Data selectString(single line)Required
    X. Select STRING DATA for Access Log (update)Data selectString(multiple line)
    -variable namevariable label
    Aconf_SecretKeySet SecretKey for Stripe Access (sk_xxx: 32 letters)
    Bconf_DataIdBSelect STRING/SELECT DATA for Description (e.g. Corp Name)
    Cconf_DataIdCSelect STRING DATA for Email
    Dconf_DataIdDSelect STRING/SELECT DATA for ExpMonth (e.g. "02")
    Econf_DataIdESelect STRING/SELECT DATA for ExpYear (e.g. "2018")
    Fconf_DataIdFSelect STRING DATA for CardNumber (without any separators)
    Gconf_DataIdGSelect STRING DATA for CVC
    Hconf_DataIdHSelect STRING DATA for Cardholder's Name
    Iconf_DataIdISelect STRING DATA for Customer ID on Stripe (update)
    Jconf_DataIdJSelect STRING DATA for Last4 of CardNumber (update)
    Wconf_DataIdWSelect STRING DATA for Status Code Log (update)
    Xconf_DataIdXSelect STRING DATA for Access Log (update)
    // Card Info to Stripe (ver. 20161007)
    // (c) 2016, Questetra, Inc. (the MIT License)
    
    //// == 工程コンフィグの参照 / Config Retrieving ==
    var secretKey = configs.get( "conf_SecretKey" ) + "";
    var dataIdB = configs.get( "conf_DataIdB" );
    var dataIdC = configs.get( "conf_DataIdC" );
    var dataIdD = configs.get( "conf_DataIdD" );
    var dataIdE = configs.get( "conf_DataIdE" );
    var dataIdF = configs.get( "conf_DataIdF" );
    var dataIdG = configs.get( "conf_DataIdG" );
    var dataIdH = configs.get( "conf_DataIdH" );
    var dataIdI = configs.get( "conf_DataIdI" );
    var dataIdJ = configs.get( "conf_DataIdJ" );
    var dataIdW = configs.get( "conf_DataIdW" );
    var dataIdX = configs.get( "conf_DataIdX" );
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var stripeDesc = "";
    if( data.get( dataIdB ) instanceof java.util.ArrayList ){
      stripeDesc = data.get( dataIdB ).get(0).getValue() + "";
    }else if( data.get( dataIdB ) instanceof java.lang.String ){
      stripeDesc = data.get( dataIdB ) + "";
    }
    var expMonth = "";
    if( data.get( dataIdD ) instanceof java.util.ArrayList ){
      expMonth = data.get( dataIdD ).get(0).getValue() + "";
    }else if( data.get( dataIdD ) instanceof java.lang.String ){
      expMonth = data.get( dataIdD ) + "";
    }
    var expYear = "";
    if( data.get( dataIdE ) instanceof java.util.ArrayList ){
      expYear = data.get( dataIdE ).get(0).getValue() + "";
    }else if( data.get( dataIdE ) instanceof java.lang.String ){
      expYear = data.get( dataIdE ) + "";
    }
    var stripeEmail = data.get( dataIdC ) + "";
    var stripeCardNum = data.get( dataIdF ) + "";
    var stripeCardCvc = data.get( dataIdG ) + "";
    var stripeCardName = data.get( dataIdH ) + "";
    
    //// == 演算 / Calculating ==
    var accessLog = "";
    var responseJson = "";
    var uri = "https://api.stripe.com/v1/customers";
    var response = httpClient.begin()
      .basic( secretKey, "" )
      .formParam( "description", stripeDesc )
      .formParam( "email", stripeEmail )
      .formParam( "source[object]", "card" )
      .formParam( "source[exp_month]", expMonth )
      .formParam( "source[exp_year]", expYear )
      .formParam( "source[number]", stripeCardNum )
      .formParam( "source[cvc]", stripeCardCvc )
      .formParam( "source[name]", stripeCardName )
      .post( uri );
    var httpStatus = response.getStatusCode() + "";
    accessLog += "---POST request--- " + httpStatus + "\n";
    accessLog += response.getResponseAsString() + "\n";
    responseJson += response.getResponseAsString() + "";
    
    var cusId = "";
    var last4 = "";
    if( httpStatus == "200" ){
      var jsonObj = JSON.parse( responseJson );
      cusId = jsonObj.id;
      last4 = jsonObj.sources.data[0].last4;
    }
    
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdI, cusId );
    retVal.put( dataIdJ, last4 );
    retVal.put( dataIdW, httpStatus );
    if( dataIdX !== "" ){
      retVal.put( dataIdX, accessLog );
    }
    

    • B’: Description information stored in the Data Item selected at config B
    • C’: Email information stored in the Data Item selected at config C
    • D’: Expiration Date (Month) information stored in the Data Item selected at config D
    • E’: Expiration Date (Year) information stored in the Data Item selected at config E
    • F’: Credit Card Number Information stored in the Data Item selected at config F
    • G’: CVC information stored in the Data Item selected at config G
    • H’: Card owner information stored in the Data Item selected at config H
    • A customer with properties B’C’D’E’F’G’H’ will be registered to Stripe
    • Customer ID to charge will be stored in the Data Item selected at config I
    • The last four digits of a registered credit card number will be stored in the Data Item selected at config J
    • (It is possible to discard the credit card information by configuring the same Item as the selection at F)
    • The status of the registration processing will be stored in the Data Item selected in config W (For handling invalid card numbers, etc.)
    • The communication log will be stored in the Data Item selected in config X
    • It requires acquiring Secret Key at Stripe Dashboard in advance
    • Supported cards or currency varies from country to country
    • MM/YY edition is for cases where D’ and E’ are stored as 1 data element (5 characters of MM/YY)