Add Paypal Support

seattle2022
Abner Coimbre 2024-11-02 16:40:45 -07:00
parent a19d57f45b
commit 190b133a9c
2 changed files with 158 additions and 12 deletions

View File

@ -59,8 +59,8 @@ features:
button_class: "seattle-bg"
class: "bg-transparent border border-orange-500 rounded-md cursor-pointer hover:bg-orange-500 hover:border-orange-500 hover:text-white focus-within:bg-orange-500 focus-within:border-orange-500 focus-within:text-white"
url: "https://buy.stripe.com/9AQ8wG0P9a5fg0wfZr"
alt_url: "https://google.com/"
alt_title: "PayPal"
alt_paypal_id: "paypal-physical-ticket"
alt_class: "text-sm hover:underline mt-4"
features_class: "text-white text-center"
features:
@ -78,15 +78,15 @@ features:
title_class: "text-white text-center"
name_class: "seattle-color"
price_class: "text-green-500"
price: "399"
original_price: ""
price: "349"
original_price: "399"
features_class: "text-white"
button:
title: "Register"
class: "bg-transparent border border-orange-500 rounded-md cursor-pointer hover:bg-green-500 hover:border-green-500 hover:text-white focus-within:bg-green-500 focus-within:border-green-500 focus-within:text-white"
url: "https://buy.stripe.com/aEU3cmgO7dhr6pWeVp"
alt_url: "https://google.com/"
alt_title: "PayPal"
alt_paypal_id: "paypal-physical-ticket-premium"
alt_class: "text-sm hover:underline mt-4"
features:
- text: "If you want to support the conference"
@ -132,8 +132,8 @@ features:
title: "Register"
class: "bg-transparent border border-orange-500 rounded-md cursor-pointer hover:bg-orange-500 hover:border-orange-500 hover:text-white focus-within:bg-orange-500 focus-within:border-orange-500 focus-within:text-white"
url: "https://buy.stripe.com/6oE4gq69t7X75lSeVo"
alt_url: "https://google.com/"
alt_title: "PayPal"
alt_paypal_id: "paypal-online-ticket"
alt_class: "text-sm hover:underline mt-4"
features_class: "text-black dark:text-white"
features:
@ -156,8 +156,8 @@ features:
title: "Register"
class: "bg-transparent border border-orange-500 rounded-md cursor-pointer hover:bg-green-500 hover:border-green-500 hover:text-white focus-within:bg-green-500 focus-within:border-green-500 focus-within:text-white"
url: "https://buy.stripe.com/9AQ8wG0P9a5fg0wfZr"
alt_url: "https://google.com/"
alt_title: "PayPal"
alt_paypal_id: "paypal-online-ticket-premium"
alt_class: "text-sm hover:underline mt-4"
features_class: "text-black dark:text-white"
features:
@ -248,4 +248,4 @@ features:
avatar: "/images/people/alasdair.jpg"
content: |
Abner Coimbre is a fantastic host & organiser with an important vision for building better software that benefits all of us, in his words: "reclaiming user value"
---
---

View File

@ -79,10 +79,16 @@
class="inline-flex justify-center w-full px-4 py-3 mt-8 font-sans text-sm leading-none text-center no-underline sm:text-base md:text-lg {{ $option.button.class }}">
{{ $option.button.title }}
</a>
{{ if $option.button.alt_url }}
<a href="{{ $option.button.alt_url }}" class="{{ $option.button.alt_class }}">
{{ $option.button.alt_title }}
</a>
{{ if $option.button.alt_paypal_id }}
<!-- PayPal integration -->
<div style="width:60%;margin:auto;">
<br>
<div id="smart-button-container">
<div style="text-align: center;">
<div id="{{ $option.button.alt_paypal_id }}"></div>
</div>
</div>
</div>
{{ end }}
</div>
@ -126,4 +132,144 @@
{{ end }} */}}
</div>
</div>
{{ end }}
<!-- PayPal JS - Live ID (?) -->
<script src="https://www.paypal.com/sdk/js?client-id=AZc6g3jzPRR4Ahf6ZeFKzBUw-TWzSIPev386n8eRe4XBTJSqnL7OtXx4YbcTN5mcI_MtvT30Bo9dxXOb&disable-funding=credit,card&currency=USD" data-sdk-integration-source="button-factory">
</script>
<script>
function physicalTicket() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'pay',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Physical Track (2024)","amount":{"currency_code":"USD","value":249}}],
application_context: { shipping_preference: 'NO_SHIPPING'}
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
// Redirect
actions.redirect('https://handmadecities.com/registered');
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-physical-ticket');
}
function physicalTicketPremium() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'pay',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Physical Track Premium (2024)","amount":{"currency_code":"USD","value":349}}],
application_context: { shipping_preference: 'NO_SHIPPING'}
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
// Redirect
actions.redirect('https://handmadecities.com/registered');
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-physical-ticket-premium');
}
function onlineTicket() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'pay',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Online Track (2024)","amount":{"currency_code":"USD","value":74}}],
application_context: { shipping_preference: 'NO_SHIPPING'}
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
// Redirect
actions.redirect('https://www.handmade-seattle.com/registered');
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-online-ticket');
}
function onlineTicketPremium() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'pay',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Online Track Premium (2024)","amount":{"currency_code":"USD","value":99}}],
application_context: { shipping_preference: 'NO_SHIPPING'}
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
// Redirect
actions.redirect('https://www.handmade-seattle.com/registered');
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-online-ticket-premium');
}
physicalTicket();
physicalTicketPremium();
onlineTicket();
onlineTicketPremium();
</script>
{{ end }}