diff --git a/app/controllers/discourse_donations/charges_controller.rb b/app/controllers/discourse_donations/charges_controller.rb index 72be0e0..1e4fb27 100644 --- a/app/controllers/discourse_donations/charges_controller.rb +++ b/app/controllers/discourse_donations/charges_controller.rb @@ -36,8 +36,8 @@ module DiscourseDonations err = e.json_body[:error] output['messages'] << "There was an error (#{err[:type]})." - #output['messages'] << "Error code: #{err[:code]}" if err[:code] - #output['messages'] << "Decline code: #{err[:decline_code]}" if err[:decline_code] + output['messages'] << "Error code: #{err[:code]}" if err[:code] + output['messages'] << "Decline code: #{err[:decline_code]}" if err[:decline_code] output['messages'] << "Message: #{err[:message]}" if err[:message] render(:json => output) and return diff --git a/assets/javascripts/lib/discourse-markdown/stripe.js.es6 b/assets/javascripts/lib/discourse-markdown/stripe.js.es6 index 729fe7e..17f6335 100644 --- a/assets/javascripts/lib/discourse-markdown/stripe.js.es6 +++ b/assets/javascripts/lib/discourse-markdown/stripe.js.es6 @@ -33,6 +33,9 @@ function insertCheckout(state, tagInfo, content, siteSettings) { let token = state.push('stripe-checkout-form-open', 'form', 1); token.attrs = [['method', 'POST'], ['action', '/charges']]; + token = state.push('stripe-checkout-form-amount', 'input', 0); + token.attrs = [['type', 'hidden'], ['name', 'amount'], ['value', tagInfo.attrs['amount']]]; + token = state.push('stripe-checkout-script-open', 'script', 0); token.attrs = [ ['src', 'https://checkout.stripe.com/checkout.js'], @@ -67,6 +70,9 @@ export function setup(helper) { 'div[class]', 'form[method]', 'form[action]', + 'input[type]', + 'input[name]', + 'input[value]', 'script[class]', 'script[src]', 'script[data-key]',