I've been playing around with the new CF7, and I'm just wondering if there is a PayPal IPN integration in CF7? Do I need to validate to see it?
Thanks
Thanks
Hi, my workaround is to put the following code in a HTML on the form and it works well for me.
Take care of your form fields you want to provide. Here in my form it is the "order_id", "overall_brutto_price".And it submits the form after successful paying without any submit button. You can leave that out for your workflow.
<!-- Set up a container element for the button -->Hope this helps
<div id="paypal-button-container"></div>
<!-- Setup an external value for invoice to be used as a test for a field -->
<!-- Include the PayPal JavaScript SDK -->
<script src="https://www.paypal.com/sdk/js?client-id=sb¤cy=EUR"></script>
<script>
function getOrderID() {
var order_id = document.getElementById('order_id').value;
// alert(order_id);
return order_id;
}
function getAmount() {
var overall_brutto_price = document.getElementById('overall_brutto_price').value;
var new_amount_string = overall_brutto_price.replace(/,/g, ".");
alert(new_amount_string);
return new_amount_string;
}
// Render the PayPal button into #paypal-button-container
paypal.Buttons({
// Configure environment
env: 'sandbox',
client: {
sandbox: 'your sandbox code here',
production: 'demo_production_client_id'
},
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '' + getAmount()
},
description: 'Your order no. ' + getOrderID()
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Now submit the form as the order is already paid per PayPal
jQuery('.ui.form').form('submit');
// alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
</script>
[br]