Answer the question
In order to leave comments, you need to log in
How to run index.js on click?
I have a small online store on NUXT.js. Everything is ready and working in it.
There is an interesting library https://github.com/lodosstm/yandex-checkout-node Yandex Checkout for Node.js
Question: How can I link them so that when I click on pay in the cart, the Yandex checkout script is launched and the client is redirected to the payment page ?
The maximum that was enough for my understanding of Node.js was to create a separate index.js file
var YandexCheckout = require('yandex-checkout')('******', '***********');
var idempotenceKey = '02347fc4-a1f0-49db-807e-f0d67c2ed5a5';
YandexCheckout.createPayment({
'amount': {
'value': '2.00',
'currency': 'RUB'
},
'payment_method_data': {
'type': 'bank_card'
},
'confirmation': {
'type': 'redirect',
'return_url': 'https://www.merchant-website.com/return_url'
}
}, idempotenceKey)
.then(function(result) {
console.log({payment: result});
})
.catch(function(err) {
console.error(err);
})
Answer the question
In order to leave comments, you need to log in
You can try to create a component in the store, which will either access a certain service on the backend and receive a payment link
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question