Test Payment Test Payment Test Payment Test Payment Test Payment Test Payment Test Payment Test Payment

var card_form = document.getElementById('card')

// Serialize the card into a valid card object.
var card = {
name: card_form.holder_name.value,
number: card_form.number.value,
expiration_month: card_form.expiration_month.value,
expiration_year: card_form.expiration_year.value,
security_code: card_form.security_code.value,
}

Omise.createToken('card', card, function(statusCode, response) {
if (statusCode == 200) {
// Success: send back the TOKEN_ID to your server to create a charge.
// The TOKEN_ID can be found in `response.id`.
} else {
// Error: display an error message. Note that `response.message` contains
// a preformatted error message. Also note that `response.code` will be
// "invalid_card" in case of validation error on the card.

// Example Error displaying
alert(response.code + ': ' + response.message)
}
})