Update to paypal api v2

parent d0be1f34
......@@ -96,7 +96,7 @@ class Cart {
$cart_version = 0.9;
load_config("cart");
global $cart_submodules;
$cart_submodules=Array("paypalbutton","hzservices","subscriptions","manualcat");
$cart_submodules=Array("paypalbuttonV2","hzservices","subscriptions","manualcat");
$cart_manualpayments = get_pconfig ($id,'cart','enable_manual_payments');
if ($cart_manualpayments) {
......
This diff is collapsed.
<script src="https://www.paypal.com/sdk/js?client-id={{$paypal_clientid}}"></script>
{{include file="../../../view/tpl/basic_cart.tpl"}}
<div class="section-content-wrapper">
{{if !$order.checkedout}}
<div class="clearfix">
<div id="paypal-button-container" class="float-left mr-2"></div>
<a href="{{$links.checkoutlink}}" class="float-left p-1">Back to Payment Options</a>
</div>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
return fetch('{{$buttonhook}}_create', {
method: 'post'
}).then(function(res){
return res.json();
}).then(function(data) {
return data.id;
});
},
onApprove: function(data, actions) {
alert("DATA: "+JSON.stringify(data));
postdata = new FormData();
postdata.append('paymentID' , data.orderID);
return fetch('{{$buttonhook}}_execute', {
method: 'POST',
body: postdata
}).then(function () {window.location = '{{$finishedurl}}';});
}
}).render('#paypal-button-container');
</script>
{{else}}
<h3>This order has been confirmed and is awaiting payment.</h3>
<h4><a href="{{$finishedurl}}">{{$finishedtext}}</a></h4>
{{/if}}
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment