Saved Card
EMBED Credit Card Script
used to tokenize credit card data before submitting data to featherpay api for saving credit card from your frontend code embed javascript initialize script specify configuration read token from onsuccess function call \#1) embed javascript include ( for prod ) < script src="https //pay featherpay io/featherpaycard js">\</ script > include (for sandbox) < script src="https //gfp pay acdev io/featherpaycard js">\</ script > \#2) initialize script new featherpaycreditcard({ selector '#form' }); \#3) specify configuration { "tab" "examples", "url" "from embedded script", "name" "specify configuration", "method" "get", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "selector", "type" "string", "description" "set when initializing script any css selector for a single target element on the webpage or any node on the webpage page " }, { "kind" "required", "name" "mode", "type" "string", "children" \[], "description" "`production` or `sandbox` \n\ndefault `sandbox`" }, { "kind" "optional", "name" "mount", "type" "string", "children" \[], "description" "`before`, `after`, `replace`, or `false` \n\ndefault `replace` \n\n`before` will mount before the supplied selector \n\n`after` will mount after the supplied selector\n\n`replace` will remove all children of the selector and insert the form into it\n" }, { "kind" "optional", "name" "fields", "type" "array", "children" \[], "description" "each field with the expectation of submit can have its name, label, and type changed the submit field can only have its label change " }, { "kind" "required", "name" "displayfields", "type" "array", "children" \[], "description" "an array of arrays containing the name of fields \n\nwill change what wrapper and the order the fields are rendered in removing a field from this will prevent it from rendering required fields, creditcard, expiry, cvv " }, { "kind" "optional", "name" "onready", "type" "object", "children" \[], "description" "default false\n\na method to execute when the form is ready to be mounted or nothing at all " }, { "kind" "optional", "name" "onchange", "type" "string", "children" \[], "description" "default false\n\na method to execute when a form field is changed or nothing at all \n\nargs the field string (creditcard, cvv), the html input field, the field value, and the validation status of the field " }, { "kind" "optional", "name" "oninvalid", "type" "string", "children" \[], "description" "default false\n\na method to execute when the form is set to invalid (cant be submitted) or nothing at all " }, { "kind" "optional", "name" "onvalid", "type" "string", "children" \[], "description" "default false\n\na method to execute when the form is set to valid (can be submitted) or nothing at all " }, { "kind" "optional", "name" "onsubmit", "type" "string", "children" \[], "description" "default false\n\na method to execute when the form is submitted or nothing at all \n\nthe form submission can be blocked by passing a return value of false in the supplied onsubmit method \n\nargs an object of the current form values " }, { "kind" "optional", "name" "onsuccess", "type" "string", "children" \[], "description" "default false\n\na method to execute when the form has been submitted successfully or nothing at all \n\nan object of the current form values, featherpay save payment object " }, { "kind" "optional", "name" "onfailure", "type" "string", "children" \[], "description" "default false\n\na method to execute when the form has failed to be submitted successfully or nothing at all " } ], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "ws4fzpo14lm1bovhpyyxs", "code" "{\n \\"name\\" \\"cake's name\\",\n }", "language" "200", "customlabel" "" }, { "id" "re1ncdsv tahvwep3mnww", "code" "{\n \\"message\\" \\"ain't no cake like that \\"\n }", "language" "404", "customlabel" "" } ], "selectedlanguageid" "ws4fzpo14lm1bovhpyyxs" }, "examples" { "languages" \[ { "id" "9fxtufcliph tyspykuh0", "code" "const defaultconfig =\n{\n mode 'production',\n mount 'replace',\n fields \n {\n name \n {\n name 'name',\n label 'name on card',\n type 'text'\n },\n creditcard \n {\n name 'creditcard',\n label 'credit card number',\n type 'tel'\n },\n expiry \n {\n name 'expiry',\n label 'expiry date',\n type 'tel'\n },\n cvv \n {\n name 'cvv',\n label 'cvv',\n type 'number'\n },\n zipcode \n {\n name 'zipcode',\n label 'zipcode',\n type 'tel'\n },\n submit \n {\n label 'submit'\n }\n },\n displayfields \[\['name'],\['creditcard'],\['expiry','cvv','zipcode'],\['submit']],\n onready false,\n onchange false,\n oninvalid false,\n onvalid false,\n onsubmit false,\n onsuccess false,\n onfailure false\n};", "language" "javascript", "customlabel" "" } ], "selectedlanguageid" "9fxtufcliph tyspykuh0" }, "description" "tokenize credit card data", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } \#4) featherpay sample card response that will be set as an argument in onsuccess { "cardtype" "visa", "ephemeraltoken" "9422925921134242", "paymenttype" "cardpointeorderpayment", "orderpaymenttype" "cardpointeorderpayment", "expiry" "1123", "paymentsubtype" "card not present" }