Add Paypal Support
This commit is contained in:
@@ -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¤cy=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 }}
|
||||
|
||||
Reference in New Issue
Block a user