jjw2015
jjw2015

Reputation: 343

Can we add more form field in braintree payments hosted fields form?

I am taking a look of using hosted fields / form in Braintree (here: https://developers.braintreepayments.com/guides/hosted-fields/setup-and-integration/javascript/v2).

In the example html form on the above page, all the fields it has are all hosted fields (cc number, exp date, cvv).

My question is: in the same form, I want to add a few more normal form fields, to collect other information, such as shipping address, delivery notes, etc.

I tried and looks like it works at least in sandbox, but since the doc doesn't mention anything like that, I just want to confirm it.

Anyone has some idea?

Thanks

Upvotes: 1

Views: 914

Answers (1)

jerry
jerry

Reputation: 312

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

You can add any additional fields to the form by just adding more input tags. Using the example from the docs, if I wanted to add first-name and last-name to the form:

<form action="/" id="my-sample-form">
  <label for="card-number">Card Number</label>
  <div id="card-number"></div>

  <label for="cvv">CVV</label>
  <div id="cvv"></div>

  <label for="expiration-date">Expiration Date</label>
  <div id="expiration-date"></div>

  <label for="first-name">First Name</label>
  <input type="text" name="first-name" id="first-name">

  <label for="last-name">Last Name</label>
  <input type="text" name="last-name" id="last-name">

  <input type="submit" value="Pay" />
</form>

Upvotes: 4

Related Questions