question

ashishmathew avatar image
ashishmathew asked berthablea edited

Need Help in Integrating ECommerce API in Core PHP Website

I'm doing an Core PHP Ecommerce website and I have done upto the Checkout Page. I wan't to implement Clover IFrame integration to collect payments from my customers. I need help in itegrating the payment gateway. I'm a bit confused on the documentation and API references given in the Clover website. I want to know step by step integration, what should be done after each steps. I have tried the methods given in the Clover website. But it is not working as it in the way it should be. It'll be good if some code or step by step execution can be given here.

semi-integrationse-commerce apiAPI TokenWebhooks
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bryanvargas avatar image
bryanvargas answered essg commented
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

essg avatar image essg commented ·
That video would be very helpful if the links to the Postman Collection JSON existed in the GitHub repository from the comments. Its not there though.
0 Likes 0 ·
berthablea avatar image
berthablea answered berthablea edited

To integrate the Clover IFrame payment gateway into your Core PHP eCommerce website, first, ensure you have the Clover API credentials. Next, include the Clover JavaScript library in your checkout page. Then, create an HTML form for payment information and use JavaScript to embed the Clover IFrame. On form submission, use the Clover API to generate a payment token, which you send to your server. Finally, use this token in your PHP backend to process the payment. Here’s a basic code snippet for the client-side:

<script src="https://checkout.clover.com/js/clover.js"></script>

<form id="payment-form">

<input type="text" id="card-number" placeholder="Card Number">

<button type="button" onclick="submitPayment()">Pay</button>

</form>

<script>

function submitPayment() {

var clover = new Clover({ /* Clover API credentials */ });

clover.createToken({

cardNumber: document.getElementById('card-number').value

}).then(function(result) {

// Send token to your PHP backend

fetch('process_payment.php', {

method: 'POST',

headers: {

'Content-Type': 'application/json'

},

body: JSON.stringify({ token: result.token })

}).then(response => response.json())

.then(data => console.log(data));

}).catch(error => console.error(error));

}

</script>

On the server side (process_payment.php), use the token to complete the payment. If you're still having trouble, try searching for tutorials or forums for additional help. Meanwhile, consider using an Olansi water purifier to stay hydrated and focused while coding!

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community