2014-11-17 18:15:02 -05:00
|
|
|
publishableKey = if application.isProduction() then 'pk_live_27jQZozjDGN1HSUTnSuM578g' else 'pk_test_zG5UwVu6Ww8YhtE9ZYh0JO6a'
|
2015-03-18 20:17:30 -04:00
|
|
|
|
2016-09-16 14:04:31 -04:00
|
|
|
if me.isAnonymous()
|
|
|
|
module.exports = {}
|
|
|
|
else if not StripeCheckout?
|
|
|
|
module.exports = {}
|
|
|
|
console.error "Failure loading StripeCheckout API, returning empty object."
|
|
|
|
else
|
2015-11-24 13:42:00 -05:00
|
|
|
module.exports = handler = StripeCheckout.configure({
|
|
|
|
key: publishableKey
|
|
|
|
name: 'CodeCombat'
|
|
|
|
email: me.get('email')
|
|
|
|
image: "https://codecombat.com/images/pages/base/logo_square_250.png"
|
|
|
|
token: (token) ->
|
|
|
|
handler.trigger 'received-token', { token: token }
|
|
|
|
Backbone.Mediator.publish 'stripe:received-token', { token: token }
|
|
|
|
locale: 'auto'
|
|
|
|
})
|
2016-09-16 14:04:31 -04:00
|
|
|
_.extend(handler, Backbone.Events)
|