am-content/Themes/khana/public/js/checkout/payment.js
// Submit the form with the token ID.
Submit the form with the token ID.
Submit the form with the token ID .
function stripeTokenHandler(token) {
      var form = document.getElementById('payment-form');
      var name_val = $('#first_name').val();
      var name = document.createElement('input');
      name.setAttribute('type', 'hidden');
      name.setAttribute('name', 'name');
      name.setAttribute('value', name_val);
      form.appendChild(name);
      var phone_val = $('#phone').val();
      var phone = document.createElement('input');
      phone.setAttribute('type', 'hidden');
      phone.setAttribute('name', 'phone');
      phone.setAttribute('value', phone_val);
      form.appendChild(phone);
      var latitude_val = $('#latitude').val();
      var latitude = document.createElement('input');
      latitude.setAttribute('type', 'hidden');
      latitude.setAttribute('name', 'latitude');
      latitude.setAttribute('value', latitude_val);
      form.appendChild(latitude);
      var longitude_val = $('#longitude').val();
      var longitude = document.createElement('input');
      longitude.setAttribute('type', 'hidden');
      longitude.setAttribute('name', 'longitude');
      longitude.setAttribute('value', longitude_val);
      form.appendChild(longitude);
      var location_input = $('#location_input').val();
      var delivery_address = document.createElement('input');
      delivery_address.setAttribute('type', 'hidden');
      delivery_address.setAttribute('name', 'delivery_address');
      delivery_address.setAttribute('value', location_input);
      form.appendChild(delivery_address);
      var shipping_val = $('#shipping').val();
      var shipping = document.createElement('input');
      shipping.setAttribute('type', 'hidden');
      shipping.setAttribute('name', 'shipping');
      shipping.setAttribute('value', shipping_val);
      form.appendChild(shipping);
      var order_details = $('#order_details').val();
      var order_note = document.createElement('input');
      order_note.setAttribute('type', 'hidden');
      order_note.setAttribute('name', 'order_note');
      order_note.setAttribute('value', order_details);
      form.appendChild(order_note);
      var payment_type_val = $('#payment_type').val();
      var payment_type = document.createElement('input');
      payment_type.setAttribute('type', 'hidden');
      payment_type.setAttribute('name', 'payment_type');
      payment_type.setAttribute('value', payment_type_val);
      form.appendChild(payment_type);
      var hiddenInput = document.createElement('input');
      hiddenInput.setAttribute('type', 'hidden');
      hiddenInput.setAttribute('name', 'stripeToken');
      hiddenInput.setAttribute('value', token.id);
      form.appendChild(hiddenInput);
      form.submit();
  }
function stripeTokenHandler ( token ) { var form = document . getElementById ( 'payment-form' ) ; var name_val = $ ( '#first_name' ) . val ( ) ; var name = document . createElement ( 'input' ) ; name . setAttribute ( 'type' , 'hidden' ) ; name . setAttribute ( 'name' , 'name' ) ; name . setAttribute ( 'value' , name_val ) ; form . appendChild ( name ) ; var phone_val = $ ( '#phone' ) . val ( ) ; var phone = document . createElement ( 'input' ) ; phone . setAttribute ( 'type' , 'hidden' ) ; phone . setAttribute ( 'name' , 'phone' ) ; phone . setAttribute ( 'value' , phone_val ) ; form . appendChild ( phone ) ; var latitude_val = $ ( '#latitude' ) . val ( ) ; var latitude = document . createElement ( 'input' ) ; latitude . setAttribute ( 'type' , 'hidden' ) ; latitude . setAttribute ( 'name' , 'latitude' ) ; latitude . setAttribute ( 'value' , latitude_val ) ; form . appendChild ( latitude ) ; var longitude_val = $ ( '#longitude' ) . val ( ) ; var longitude = document . createElement ( 'input' ) ; longitude . setAttribute ( 'type' , 'hidden' ) ; longitude . setAttribute ( 'name' , 'longitude' ) ; longitude . setAttribute ( 'value' , longitude_val ) ; form . appendChild ( longitude ) ; var location_input = $ ( '#location_input' ) . val ( ) ; var delivery_address = document . createElement ( 'input' ) ; delivery_address . setAttribute ( 'type' , 'hidden' ) ; delivery_address . setAttribute ( 'name' , 'delivery_address' ) ; delivery_address . setAttribute ( 'value' , location_input ) ; form . appendChild ( delivery_address ) ; var shipping_val = $ ( '#shipping' ) . val ( ) ; var shipping = document . createElement ( 'input' ) ; shipping . setAttribute ( 'type' , 'hidden' ) ; shipping . setAttribute ( 'name' , 'shipping' ) ; shipping . setAttribute ( 'value' , shipping_val ) ; form . appendChild ( shipping ) ; var order_details = $ ( '#order_details' ) . val ( ) ; var order_note = document . createElement ( 'input' ) ; order_note . setAttribute ( 'type' , 'hidden' ) ; order_note . setAttribute ( 'name' , 'order_note' ) ; order_note . setAttribute ( 'value' , order_details ) ; form . appendChild ( order_note ) ; var payment_type_val = $ ( '#payment_type' ) . val ( ) ; var payment_type = document . createElement ( 'input' ) ; payment_type . setAttribute ( 'type' , 'hidden' ) ; payment_type . setAttribute ( 'name' , 'payment_type' ) ; payment_type . setAttribute ( 'value' , payment_type_val ) ; form . appendChild ( payment_type ) ; var hiddenInput = document . createElement ( 'input' ) ; hiddenInput . setAttribute ( 'type' , 'hidden' ) ; hiddenInput . setAttribute ( 'name' , 'stripeToken' ) ; hiddenInput . setAttribute ( 'value' , token . id ) ; form . appendChild ( hiddenInput ) ; form . submit ( ) ; }
Submit the form with the token ID.
Submit the form with the token ID .
// Insert the token ID into the form so it gets submitted to the server //create new //create new //create new //create new //create new //create new //create new //create new // Submit the form