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
Specify Configuration
Tokenize Credit Card Data
GET
From embedded Script
Body Parameters
- selectorstringrequiredDescription
- modestringrequiredDescription
- mountstringDescription
- fieldsArrayDescription
- displayFieldsArrayrequiredDescription
- onReadyObjectDescription
- onChangestringDescription
- onInvalidstringDescription
- onValidstringDescription
- onSubmitstringDescription
- onSuccessstringDescription
- onFailurestringDescription
javascript
const defaultConfig =
{
mode: 'production',
mount: 'replace',
fields:
{
name:
{
name: 'name',
label: 'Name on Card',
type: 'text'
},
creditcard:
{
name: 'creditcard',
label: 'Credit Card Number',
type: 'tel'
},
expiry:
{
name: 'expiry',
label: 'Expiry Date',
type: 'tel'
},
cvv:
{
name: 'cvv',
label: 'CVV',
type: 'number'
},
zipcode:
{
name: 'zipcode',
label: 'Zipcode',
type: 'tel'
},
submit:
{
label: 'Submit'
}
},
displayFields: [['name'],['creditcard'],['expiry','cvv','zipcode'],['submit']],
onReady: false,
onChange: false,
onInvalid: false,
onValid: false,
onSubmit: false,
onSuccess: false,
onFailure: false
};200
{
"name": "Cake's name",
}404
{
"message": "Ain't no cake like that."
}#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"
}