work on payment code
This commit is contained in:
+55
-14
@@ -179,25 +179,11 @@ $(".show-modal").click(function() {
|
||||
$("#modal").addClass("is-active");
|
||||
});
|
||||
|
||||
$(".abo_pay").click(function() {
|
||||
console.log("pay...");
|
||||
el = $(this).parent().find(".abo_add_years");
|
||||
counter = Number(el.html());
|
||||
if (counter > 0) {
|
||||
$("#cart").addClass("is-active");
|
||||
}
|
||||
});
|
||||
|
||||
$("#cart-close").click(function() {
|
||||
console.log("blabla");
|
||||
$("#cart").removeClass("is-active");
|
||||
});
|
||||
|
||||
$("#cart-pay").click(function() {
|
||||
console.log("hoopla");
|
||||
$("#cart").removeClass("is-active");
|
||||
});
|
||||
|
||||
$(".abo_plus").click(function() {
|
||||
console.log("abo_plus");
|
||||
el = $(this).parent().find(".abo_add_years");
|
||||
@@ -232,6 +218,15 @@ $(".abo_minus").click(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$(".abo_pay").click(function() {
|
||||
console.log("pay...");
|
||||
el = $(this).parent().find(".abo_add_years");
|
||||
counter = Number(el.html());
|
||||
if (counter > 0) {
|
||||
$("#cart").addClass("is-active");
|
||||
}
|
||||
});
|
||||
|
||||
$("#modal-close").click(function() {
|
||||
console.log("blabla");
|
||||
$("#modal").removeClass("is-active");
|
||||
@@ -303,6 +298,52 @@ $("#modal-save").click(function() {
|
||||
$("#modal").removeClass("is-active");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
|
||||
<script>
|
||||
|
||||
var stripe = Stripe('pk_test_YkSGqH3Tk9WKK9HrlY63GhAg');
|
||||
|
||||
$("#cart-pay").click(function() {
|
||||
console.log("hoopla");
|
||||
$("#cart").removeClass("is-active");
|
||||
|
||||
$.ajax({
|
||||
url: "getstripesession",
|
||||
type: "get", //send it through get method
|
||||
dataType: "json",
|
||||
data: {
|
||||
charge_name: "Abo",
|
||||
charge_description: "Desription",
|
||||
charge_amount_rappen: 500,
|
||||
charge_quantity: 1
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('pay success');
|
||||
console.log(response.stripesessionid);
|
||||
console.log('rc: '+response.rc);
|
||||
if (response.rc == 0) {
|
||||
console.log('redirectToCheckout');
|
||||
stripe.redirectToCheckout({
|
||||
sessionId: response.stripesessionid
|
||||
}).then(function (result) {
|
||||
// If `redirectToCheckout` fails due to a browser or network
|
||||
// error, display the localized error message to your customer
|
||||
// using `result.error.message`.
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
console.log('getstripesession error');
|
||||
//Do Something to handle error
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user