Integrate Mpesa API with google forms -


i want integrate mpesa api google form. users using form pay, let registration fee

i think possible using apps script create google form.

forms service

this service allows scripts create, access, , modify google forms.

here sample code creating google form using apps scripts.

// create new form, add checkbox question, multiple choice question, // page break, date question , grid of questions. var form = formapp.create('new form'); var item = form.addcheckboxitem(); item.settitle('what condiments on hot dog?'); item.setchoices([         item.createchoice('ketchup'),         item.createchoice('mustard'),         item.createchoice('relish')     ]); form.addmultiplechoiceitem()     .settitle('do prefer cats or dogs?')     .setchoicevalues(['cats','dogs'])     .showotheroption(true); form.addpagebreakitem()     .settitle('getting know you'); form.adddateitem()     .settitle('when born?'); form.addgriditem()     .settitle('rate interests')     .setrows(['cars', 'computers', 'celebrities'])     .setcolumns(['boring', 'so-so', 'interesting']); logger.log('published url: ' + form.getpublishedurl()); logger.log('editor url: ' + form.getediturl()); 

then can integrate third party api in apps scripts.

external apis

google apps script can interact apis on web. guide shows how work different types of apis in scripts.

dozens of google apis available in apps script, either built-in services or advanced services. if want use google (or non-google) api isn't available apps script service, can connect api's public http interface through url fetch service.

the following example makes request youtube api , returns feed of videos match query skateboarding dog.

var url = 'https://gdata.youtube.com/feeds/api/videos?'     + 'q=skateboarding+dog'     + '&start-index=21'     + '&max-results=10'     + '&v=2'; var response = urlfetchapp.fetch(url); logger.log(response); 

similarly, following example uploads video youtube. using urlfetchapp.fetch()

var payload = 'xxxxx'; // replace raw video data. var headers = {     'gdata-version': '2',     'slug': 'dog-skateboarding.mpeg'     // add other required parameters youtube api. }; var url = 'https://uploads.gdata.youtube.com/feeds/api/users/default/uploads'; var options = {     'method': 'post',     'headers': headers,     'payload': payload }; var response = urlfetchapp.fetch(url, options); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -