top of page

Forum Posts

rashagrace
Apr 09, 2019
In Coding with Velo
I am creating a payment form for a contest page. I was following this YouTube tutorial (pasting exact moment in video where I'm stuck) https://youtu.be/vkkUIQVSMgo?t=817 When I get to the part of creating changeState(); I get the error "changeState is not defined" even though the person in the video doesn't seem to have an issue. Below, here is the complete code: import { createToken, encodeCard } from "public/stripeAPI.js"; import { charge } from 'backend/stripeProxy'; var payment; export function payNow(event) { createToken(encodeCard(createCard())) .then((token) => { console.log("Card token: " + token); charge(token, payment) .then((chargeResponse) => { console.log("Charge ID: " + chargeResponse.id); }); }); function createCard() { return { "name": $w("#cardName").value, "number": $w("#cardNumber").value, "cvc": $w("#cvc").value, "exp_year": $w("#exYear").value, "exp_month": $w("#exMonth").value, }; } function changeState() { payment = { "amount": ($w("#amount").value * 100), "currency": "USD", "description": $w("#description").value } } } export function payFee_click(event) { payNow(event); } export function amount_change(event) { changeState(); } export function description_change(event) { changeState(); } Any help would be appreciated!
Stripe API Help content media
0
3
235

rashagrace

More actions
bottom of page