diff --git a/app/plan.rb b/app/plan.rb
index fbaf7d6f..0f9ab44e 100644
--- a/app/plan.rb
+++ b/app/plan.rb
@@ -110,24 +110,24 @@ end
def paypal_recurring_hash
{
- ipn_url: "#{url}/webhooks/paypal",
- description: 'Neocities Supporter',
+ ipn_url: "https://neocities.org/webhooks/paypal",
+ description: 'Neocities Supporter - Monthly',
amount: Site::PLAN_FEATURES[:supporter][:price].to_s,
currency: 'USD'
}
end
def paypal_recurring_authorization_hash
- url = ENV['RACK_ENV'] == 'development' ? 'http://127.0.0.1:9292' : 'https://neocities.org'
paypal_recurring_hash.merge(
- return_url: "#{url}/plan/paypal/return",
- cancel_url: "#{url}/plan",
- ipn_url: "#{url}/webhooks/paypal"
+ return_url: "https://neocities.org/plan/paypal/return",
+ cancel_url: "https://neocities.org/plan",
+ ipn_url: "https://neocities.org/webhooks/paypal"
)
end
get '/plan/paypal' do
require_login
+ redirect '/plan' if parent_site.supporter?
hash = paypal_recurring_authorization_hash
@@ -145,13 +145,13 @@ end
get '/plan/paypal/return' do
require_login
- if params[:TOKEN].nil? || params[:PAYERID].nil?
+ if params[:token].nil? || params[:PayerID].nil?
flash[:error] = 'Unknown error, could not complete the request. Please contact Neocities support.'
end
ppr = PayPal::Recurring.new(paypal_recurring_hash.merge(
- token: params[:TOKEN],
- payer_id: params[:PAYERID]
+ token: params[:token],
+ payer_id: params[:PayerID]
))
paypal_response = ppr.request_payment
@@ -162,10 +162,10 @@ get '/plan/paypal/return' do
ppr = PayPal::Recurring.new(paypal_recurring_authorization_hash.merge(
frequency: 1,
- token: params[:TOKEN],
+ token: params[:token],
period: :monthly,
reference: current_site.id.to_s,
- payer_id: params[:PAYERID],
+ payer_id: params[:PayerID],
start_at: Time.now,
failed: 3,
outstanding: :next_billing
@@ -173,9 +173,10 @@ get '/plan/paypal/return' do
paypal_response = ppr.create_recurring_profile
- current_site.paypal_token = params[:TOKEN]
+ current_site.paypal_token = params[:token]
current_site.paypal_profile_id = paypal_response.profile_id
current_site.paypal_active = true
+ current_site.plan_type = 'supporter'
current_site.save_changes validate: false
redirect '/plan/thanks-paypal'
@@ -185,3 +186,16 @@ get '/plan/thanks-paypal' do
require_login
erb :'plan/thanks-paypal'
end
+
+get '/plan/paypal/cancel' do
+ require_login
+ redirect '/plan' unless parent_site.paypal_active
+ ppr = PayPal::Recurring.new profile_id: parent_site.paypal_profile_id
+ ppr.cancel
+
+ parent_site.paypal_active = false
+ parent_site.paypal_profile_id = nil
+ parent_site.paypal_token = nil
+ parent_site.save_changes validate: false
+ redirect '/plan'
+end
diff --git a/app_helpers.rb b/app_helpers.rb
index 5590c189..af4c4f32 100644
--- a/app_helpers.rb
+++ b/app_helpers.rb
@@ -105,6 +105,10 @@ def plan_pricing_button(plan_type)
button_title = parent_site.plan_type == 'free' ? 'Upgrade' : 'Change'
end
+ if button_title == 'Change' && parent_site && parent_site.paypal_active
+ return %{Change}
+ end
+
%{#{button_title}}
end
end
diff --git a/models/site.rb b/models/site.rb
index 54920fa3..92a2c0b0 100644
--- a/models/site.rb
+++ b/models/site.rb
@@ -1061,6 +1061,7 @@ class Site < Sequel::Model
# Note: Change Stat#prune! if you change this business logic.
def plan_type
+ return 'supporter' if owner.values[:paypal_active] == true
return 'free' if owner.values[:plan_type].nil?
return 'supporter' if owner.values[:plan_type].match /^plan_/
return 'supporter' if owner.values[:plan_type] == 'special'
diff --git a/views/plan/_pricing.erb b/views/plan/_pricing.erb
index 5856f813..c1803733 100644
--- a/views/plan/_pricing.erb
+++ b/views/plan/_pricing.erb
@@ -214,7 +214,7 @@
<% unless params[:stripe_token] || (current_site && parent_site.stripe_customer_id) %>
- Don't have a Credit/Debit Card? We support Bitcoin and Paypal! Click here for more information.
+ Don't have a Credit/Debit Card? We also support Paypal and Bitcoin.
<% end %>
diff --git a/views/plan/bitcoin.erb b/views/plan/bitcoin.erb
index 5d3bf3cd..4a1fa8c1 100644
--- a/views/plan/bitcoin.erb
+++ b/views/plan/bitcoin.erb
@@ -12,15 +12,15 @@
- The Bitcoin Homesteader Plan
+ The Bitcoin Lifer Plan
- We don't have a good way to charge recurring with Bitcoin (that adheres to Bitcoin's decentralized principles). So instead, we've put together a lifer plan. Basically, if you send us $50 worth of BTC, we'll never charge you again for the supporter upgrade, and you'll basically get it forever!
+ We don't have a good way to charge recurring with Bitcoin (that adheres to Bitcoin's decentralized principles). So instead, we've put together a special Bitcoin Lifer Plan. Basically, if you send us $100 worth of BTC at current market price, we'll never charge you again for the supporter upgrade, and you'll basically get it forever!
Be sure to contact us after sending with the transaction ID so we can confirm and upgrade your account.
- We don't cash out the Bitcoin. Many of our providers accept Bitcoin, and we use it to pay them.
+ We generally hold Bitcoin. Many of our vendors accept Bitcoin, and we often use it to pay them.

diff --git a/views/plan/thanks-paypal.erb b/views/plan/thanks-paypal.erb
index 4c082d97..bb9c8032 100644
--- a/views/plan/thanks-paypal.erb
+++ b/views/plan/thanks-paypal.erb
@@ -12,11 +12,7 @@
You signed up for the Supporter Plan.
Thank you for your support!
- There is one more quick thing you must do to have your supporter account enabled. Contact us and give us your Neocities username so we can enable the supporter status for your account. We are working on automating this process in the near future, our apologies for the extra step!
-
-
-
- Your support allows Neocities to continue our project to bring back the web. We will do our best to ensure that the site remains a great place for people to express themselves - one web page at a time.
+ Your support allows Neocities to continue our project to bring back the creative web. We will do our best to ensure that the site remains a great place for people to express themselves - one web page at a time.
diff --git a/views/welcome.erb b/views/welcome.erb
index eaaeebb6..2dfa1741 100644
--- a/views/welcome.erb
+++ b/views/welcome.erb
@@ -96,7 +96,7 @@
Upgrade for $<%= Site::PLAN_FEATURES[:supporter][:price] %>/mo
- or pay with PayPal or Bitcoin
+ or pay with PayPal or Bitcoin