Comments (18)
Can you give more information? I just tested and Adyen is working for me. Does your terminal show any errors?
from expresscart.
Terminal doesn't show any errors, it's just Ayden doesn't appear on the payment options (ss above)
from expresscart.
Could you check the browser console too for any errors. It's highly likely a config issue given it's working perfectly fine for me.
from expresscart.
from expresscart.
Quick question: How do I implement this on my version? I tried putting the code, doesn't work.
from expresscart.
Quick question: How do I implement this on my version? I tried putting the code, doesn't work.
Added in 41c997e.
from expresscart.
Terminal doesn't show any errors, it's just Ayden doesn't appear on the payment options (ss above)
Could you show the config where you are turning on Adyen? Maybe even share your Adyen config with the sensitive parts removed?
from expresscart.
Alr, and also to let you know I modified the code but I am not sure if it was the one causing the error, so I was trying to add GCash as an payment option for the site and here's the modified code (not really much modified)
// adyen.js btw
const express = require('express');
const { indexOrders } = require('../indexing');
const numeral = require('numeral');
const { Client, CheckoutAPI } = require('@adyen/api-library');
const { getId, sendEmail, getEmailTemplate } = require('../common');
const { getPaymentConfig } = require('../config');
const { emptyCart } = require('../cart');
const router = express.Router();
router.post('/setup', async (req, res, next) => {
const adyenConfig = getPaymentConfig('adyen');
const client = new Client({
apiKey: adyenConfig.apiKey,
environment: adyenConfig.environment
});
const checkout = new CheckoutAPI(client);
let paymentsResponse;
try{
paymentsResponse = await checkout.paymentMethods({
amount: {
currency: 'PHP',
value: 0
},
countryCode: 'PH',
channel: 'Web',
merchantAccount: adyenConfig.merchantAccount
});
}catch(ex){
console.log('Exception getting supported payment methods', ex.message);
res.status(400).json({ message: `Failed to retrieve payment methods.${ex.message}` });
}
res.status(200).json({
paymentsResponse,
environment: adyenConfig.environment,
originKey: adyenConfig.originKey
});
});
router.post('/checkout_action', async (req, res, next) => {
const db = req.app.db;
const config = req.app.config;
const adyenConfig = getPaymentConfig('adyen');
const client = new Client({
apiKey: adyenConfig.apiKey,
environment: adyenConfig.environment
});
// Rest are the same code as in the repo
from expresscart.
Used wrong link - here's the correct link: https://docs.adyen.com/payment-methods/gcash/api-only
from expresscart.
I've updated the Adyen integration to the latest and greatest here: 7c29782.
Note: The configuration changes: /config/payment/config/adyen.json
I can't test the specific payment method you are trying to use. Let me know how you get on.
from expresscart.
So, I just filled out the new config of Adyen and I tried running it but returns this error while running it.
Edit: Nevermind, I accidentally added an old config line
from expresscart.
So I tried to setup the Adyen, and it still the same as earlier but now it has error on console:
Error only show when I am on checkout page
from expresscart.
There was come config values which were removed. Check your config matches the adyen.json
example. Checking carefully there is no old configs that are no longer needed with the new version.
from expresscart.
Here is my current config for adyen
{
"description": "Card payment",
"environment": "test",
"apiKey": "API here",
"clientKey": "key here",
"merchantAccount": "Account here",
"currency": "AUD",
"countryCode": "AU"
}
from expresscart.
I think the payment type you want is quite niche and I'm not sure most will benefit by me adding it to master.
Re-reading the guide, is seems the GCash payment method isn't supported on the drop-in UI/integration which I've built for.
It looks easy enough to integrate though. You can simply add something like this code to your /setup
endpoint in adyen.js
: https://docs.adyen.com/payment-methods/gcash/api-only#api-only-payments
Then something like this (not tested at all) in /public/javascripts/common.js
:
if($('#dropin-container').length > 0){
$.ajax({
method: 'POST',
url: '/adyen/setup'
})
.done(async function(response){
$('#adyen-gcash-link').attr('href', response.action.url);
})
.fail(function(msg){
showNotification(msg.responseJSON.message, 'danger');
});
};
The idea is to get the response from
/adyen/setup
and set the URL of the link on the payment form.
Then in /views/partials/payments/adyen.hbs
add something like:
<div>
<a href="#" class="btn btn-primary" id="adyen-gcash-link"></a>
</div>
from expresscart.
Alright, but in the code that you sent me, should I replace it with the current code in the script or just add those? And for the GCash API, I think all are already except for the paymentMethod
right?
// COMMON.JS
if($('#dropin-container').length > 0){
$.ajax({
method: 'POST',
url: '/adyen/setup'
})
.done(async function(response){
const configuration = {
environment: response.environment,
clientKey: response.clientKey,
session: {
id: response.paymentsResponse.id,
sessionData: response.paymentsResponse.sessionData
},
onPaymentCompleted: (result, component) => {
console.log('result', result);
console.log('component', component);
if($('#shipping-form').validator('validate').has('.has-error').length === 0){
$.ajax({
type: 'POST',
url: '/adyen/checkout_action',
data: {
paymentCode: result.resultCode,
paymentId: component._id
}
}).done((response) => {
window.location = '/payment/' + response.paymentId;
}).fail((response) => {
showNotification('Failed to complete transaction', 'danger', true);
});
}
},
onError: (error, component) => {
console.log(error.name, error.message, error.stack, component);
},
paymentMethodsConfiguration: {
hasHolderName: false,
holderNameRequired: false,
billingAddressRequired: false
}
};
const checkout = await AdyenCheckout(configuration);
checkout.create('dropin').mount('#dropin-container');
})
.fail(function(msg){
showNotification(msg.responseJSON.message, 'danger');
});
};
from expresscart.
This is my current code on adyen.js
const payload = {
merchantAccount: adyenConfig.merchantAccount,
amount: {
currency: adyenConfig.currency,
value: numeral(req.session.totalCartAmount).format('0.00').replace('.', '')
},
paymentMethod: {
type: 'gcash',
storedPaymentMethodId: "7219687191761347"
},
returnUrl: `${config.baseUrl}/adyen/checkout_return`,
reference: Object.keys(req.session.cart)[0],
countryCode: adyenConfig.countryCode,
shopperEmail: req.session.customerEmail
};
I don't really know how it should be even though I read the docs
from expresscart.
Ok. I've had a quick play and got it working.
adyen.js
:
router.post('/setup', async (req, res, next) => {
const config = req.app.config;
const adyenConfig = getPaymentConfig('adyen');
const payload = {
merchantAccount: adyenConfig.merchantAccount,
amount: { currency: 'PHP', value: 1000 },
paymentMethod: {
type: 'gcash'
},
returnUrl: `${config.baseUrl}/adyen/checkout_return`,
reference: Object.keys(req.session.cart)[0]
};
let paymentsResponse;
try{
paymentsResponse = await got.post(`https://checkout-${adyenConfig.environment}.adyen.com/v67/payments'`, {
headers: {
'content-type': 'application/json',
'x-API-key': adyenConfig.apiKey
},
json: payload
});
paymentsResponse = JSON.parse(paymentsResponse.body);
}catch(ex){
console.log('Exception getting supported payment methods', ex.message);
res.status(400).json({ message: `Failed to retrieve payment methods.${ex.message}` });
return;
}
res.status(200).json({
paymentsResponse,
environment: adyenConfig.environment
});
});
common.js
:
if($('#adyen-gcash-container').length > 0){
$.ajax({
method: 'POST',
url: '/adyen/setup'
})
.done(async function(response){
$('#adyen-gcash-link').attr('href', response.paymentsResponse.action.url);
$('#adyen-gcash-link').text('Pay GCash');
})
.fail(function(msg){
showNotification(msg.responseJSON.message, 'danger');
});
};
adyen.hbs
<div>
<div class="mb-2">{{@root.paymentConfig.adyen.description}}</div>
<div id="adyen-gcash-container">
<a href="#" class="btn btn-primary" id="adyen-gcash-link">Loading...</a>
</div>
</div>
Note: I have no idea what GCash actually is and how to test a payment so the
/checkout_action
return code will need some work
from expresscart.
Related Issues (20)
- Error if the length of the Permalink of product is set to 24 HOT 3
- Security Contact HOT 3
- Does the Google font Material+Icons still needed? HOT 1
- Demo is Not Working HOT 2
- expresscart and wordpress HOT 2
- API HOT 1
- Products & navigation multiple languages HOT 1
- Can't change Theme in admin panel HOT 2
- No Sign up / register page HOT 2
- [Suggestion] A new CSS for the website HOT 1
- Demo not working HOT 7
- Allow Image URL upload for main product image
- Add SECURITY.md HOT 2
- Docker build seems broken HOT 6
- Stripe Webhook endpoint URL
- How to create customer account?
- Proccess payment not working
- Store search through the menu does not work fully HOT 1
- Making the project much optimise HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expresscart.