Implement Frontend and Integrate APIs
Choose Button Design
Implement Frontend to start payment
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Store</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="card">
<img src="tshirt.jpg" alt="Tshirt" style="width:100%">
<h1>Cotton T-shirt</h1>
<p class="price">$0.001</p>
<p>ATC 5050 Everyday Cotton Blend Tee</p>
<p><button onclick="handleOrder()">Buy</button></p>
</div>
</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
const API_URL = 'YOUR_API_URL'
function handleOrder() {
axios.post(`${API_URL}/create-order`, {amount: '0.001'})
.then((res) => {
console.log('res', res.data)
const {data} = res
if(data.payment_url) {
console.log('vao day')
window.open(data.payment_url, '_blank').focus();
}
})
.catch(err => {
alert('error')
console.error(err)
})
}
</script>
</html>Implement Frontend to return after payment completed

Summary
Last updated
