Skip to content

createCardToken "Invalid primary field found" #135

Closed Answered by gdeandradero
lucerojulian asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, how are you?

About createCardToken function:

Instead of your current custom inputs for the following fields: expirationDate, cardNumber and securityCode, you should put three divs:

<div id="expirationDate"></div>
<div id="cardNumber"></div>
<div id="securityCode"></div>

After, you need to put the following code:

const cardNumberElement = mp.fields.create('cardNumber', {
  placeholder: "Número do cartão"
}).mount('cardNumber');

const expirationDateElement = mp.fields.create('expirationDate', {
  placeholder: "MM/YY",
}).mount('expirationDate');

const securityCodeElement = mp.fields.create('securityCode', {
  placeholder: "Código de segurança"
}).mount('securityCode');

The method…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lucerojulian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants