Skip to content

Instantly share code, notes, and snippets.

@ahoshaiyan
Created September 8, 2021 09:07
Show Gist options
  • Save ahoshaiyan/ec2537c60445dca8f24ae8086be90528 to your computer and use it in GitHub Desktop.
Save ahoshaiyan/ec2537c60445dca8f24ae8086be90528 to your computer and use it in GitHub Desktop.
Use Moyasar Form within a VueJs Compoenent
<!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>Vue JS with Moyasar Form</title>
<!-- Styles -->
<link rel="stylesheet" href="https://cdn.moyasar.com/mpf/1.4.0/moyasar.css">
<!-- Scripts -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=fetch"></script>
<script src="https://cdn.moyasar.com/mpf/1.4.0/moyasar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
<div id="app">
<h2>{{ message }}</h2>
<div class="mysr-form"></div>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Welcome to Awesome Cookie Store!'
},
mounted: function () {
// When your component is mounted, render the form within
Moyasar.init({
element: '.mysr-form',
amount: 1000,
currency: 'SAR',
description: 'Coffee Order #1',
publishable_api_key: 'pk_test_AQpxBV31a29qhkhUYFYUFjhwllaDVrxSq5ydVNui',
callback_url: 'https://moyasar.com/thanks',
methods: [
'creditcard',
],
})
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment