Hi everyone. I am trying to integrate chase pay into the wix website I currently manage. The chase pay comes from Authorize.net. I’ve looked at different forums and references, but cannot seem to figure out what I am doing wrong. I will say that I am not an expert in coding and have a limited understanding of it.
So, comes my question: what is my code missing?
I keep getting the error code in the developer tools of chrome and in the developer console.
“Error parsing web-module ‘backend/authorizeNet.jsw’: Unexpected token (33:1) while parsing file: backend/authorizeNet.jsw”
PAGE CODE
import {chargeCreditCard} from ‘backend/authorizeNet’;
export function button4_click(event) {
chargeCreditCard();
} let customerID, amount, cardNumber, cardName, cardCVC, cardMonth, cardYear, newData, bodyOut;
customerID = $w("#customerID");
amount = $w("#amount");
cardNumber = $w("#cardNumber");
cardName = $w("#cardName");
cardCVC = $w("#cardCVC");
cardMonth = $w("#cardMonth");
cardYear = $w("#cardYear");
if (customerID.valid && cardNumber.valid && cardMonth.valid && cardYear.valid && cardCVC.valid && cardName.valid && amount.value > 0) {
bodyOut = charge(customerID.value, amount.value, cardNumber.value, cardMonth.value, cardYear.value, cardCVC.value);
//I want to use the body
} else {
console.log(“oops!”);
}
}
BACKEND CODE
For reference, I have replaced the API login and Trans Key with "****"
//backend/authorizeNet
import {fetch} from ‘wix-fetch’;
export function chargeCreditCard() {
const apiLogin = “**********”;
const transactionKey = “*****************”;
const url = “https://api.authorize.net/xml/v1/request.api/createTransactionRequest”
let data = {
“createTransactionRequest”: {
“merchantAuthentication”: {
“name”: “********”,
“transactionKey”: “*************”
},
“transactionRequest”: {
“transactionType”: “authCaptureTransaction”,
“amount”: “51”,
“payment”: {
“creditCard”: {
“cardNumber”: “4111111111111111”,
“expirationDate”: “2020-12”,
“isPaymentToken”: true ,
“cryptogram”: “EjRWeJASNFZ4kBI0VniQEjRWeJA=”,
“tokenRequestorName”: “CHASE_PAY”,
“tokenRequestorId”: “12345678901”,
“tokenRequestorEci”: “07”
}
}
}
}
}
Any help would be great! thank you so much!