Connect with us

Publications

Accepting Payments With The Wix Payment API

Published

on

David Rosenblatt Hacker Noon profile picture

@drosenblattDavid Rosenblatt

“When I was younger I could remember anything, whether it happened or not.”

The project

I’m a Wix Legacy Partner and have been working with Wix for over 6 years.  I am also a member of the 1972 graduating class from Orange Highschool in Ohio. Next year will be the 50th Year Class Reunion for my fellow graduates. I volunteered to create a website that allowed the, now 66 – 68-year-old, classmates to register for specific activities. I also created a donation function to help defer the cost of the rather elaborate weekend.

As with all sites I build, this site was built on the Wix platform. Some of the functions used Wix supplied apps (notably the Events app). Some functions used basic Velo coding and data collections, but one function, donations, was built from scratch using the Wix Payment API.

Donation Form

Wix Pay is the built-in system to collect payments on Wix and, thanks to its API, I was able to create, with a small amount of code, a donation form that allows the user to decide the amount they wish to donate.

Upon completing and submitting the form, Velo creates a payment that prompts a payment pop-up.  If the payment is validated, the submission is recorded and the user is automatically added to the sponsors list.

How I Made It

First, I created the payment form with input elements to collect the user’s first name, last name, email, and the amount they wish to donate. I then connected the form’s input to a dataset (a representation of a database entry) and bound the submit button to the save operation. Finally I connected the success and error messages to text elements. And that is it for the UI!

The Code (Frontend)

Before accepting a donation I needed to create and then trigger the payment. The process is therefore started by the `onBeforeSave` hook on the dataset. The hook creates the payment via a backend function `createDonationPayment` that it receives the form value as a JSON. The payment is then used to trigger the payment via the wixPay API (frontend).

If the payment is successful, the save operation will proceed otherwise the operation is cancelled.

import wixPay from 'wix-pay'; import { createDonationPayment } from "backend/donation.jsw"; $w.onReady(function () { const $donationDataset = $w("#donationDataset"); $donationDataset.onBeforeSave(() => triggerPayment($donationDataset.getCurrentItem()));
}); /**
* @param {import("public/types").DonationData} donationData
*/
async function triggerPayment(donationData) { const $errorText = $w("#errorText"); const isDonationCompleted = donationData.firstName && donationData.lastName && donationData.email && donationData.donationAmount if(!isDonationCompleted) { $errorText.text = "Form is not completed" return false; } const payment = await createDonationPayment(donationData).catch(reason => { console.error("payment could not be initialized", reason); return {id: null} }) const result = await wixPay.startPayment(payment.id).catch(reason => { console.error("payment failed", reason); $errorText.text = "Payment Failed. Contact the administrator"; }); if(!result) return false; if(result.status === "Cancelled") { $errorText.text = ""; return false; } else if(result.status !== "Successful") { console.warn("payment is not successful", result) $errorText.text = "Payment Failed. Contact the administrator"; return false; } else { return true; }
}

The donation is processed by Wix Payments, the contact information is written to a data collection and then refreshed to a Sponsors page where the donor’s name and email address are added to a repeater display.

One of the reasons the donation information is recorded  in a data collection is to make it available to download as a CSV file, for other record keeping purposes.

Finally, an autoresponder is used to send a Thankyou Letter to the donor using dynamic values inserted from the data collection.

The Code (backend)

Here I used a web module (Wix internal backend endpoint) to generate a payment based on the information collected in the form.

import wixPayBackend from 'wix-pay-backend'; /**
* @param {import("public/types").DonationData} donationData
*/
export function createDonationPayment(donationData) { if(!donationData) throw new Error('missing donation data') const amount = donationData.donationAmount; if(!amount || amount < 1) throw new Error("invalid amount(" + amount + ")"); /** @type wix_pay_backend.PaymentUserInfo */ const userInfo = { firstName: donationData.firstName, lastName: donationData.lastName, email: donationData.email, countryCode: 'USA', phone: null, } /** @type wix_pay_backend.PaymentInfo */ const paymentInfo = { items: [ { name: "Donation to OHS'72.org", price: amount } ], amount: amount, userInfo: userInfo, }; return wixPayBackend.createPayment(paymentInfo);
}

Ascend as a Non-coding Solution

While all this could have been accomplished using Wix Forms, the reunion committee did not want to pay for Ascend (premium CRM from Wix) for no other reason than to collect donations.  They felt that between the gateway fees and the additional cost of the website for a Business Premium Plan (allowing them a payment gateway) they were paying enough fees.  This system accomplishes all that they need while keeping the user’s journey simple.  This ease of use is important as the demographic of the users (66-68 years old) suggests they may be less than computer savvy.

Security Issues & Trade-Offs

Because of the limited scale of the project I didn’t need to secure the functionality more than necessary instead choosing to keep everything as simple as possible.

The main issue with the current architecture is that the Donations Collection (database table)  is open to “write” by any user. This means a hacker could insert a donation record directly into our database bypassing the donation form and the payment transaction.  Even though this scenario is possible, it is unlikely to happen, won’t harm the project overall, and could easily be recovered based on the transaction history. 

Should you have any questions about this project, please contact me at [email protected]

This article is part of a writing contest hosted by Hacker Noon in partnership with Wix. Learn how to enter here and take a shot at winning $1000 every month, from March 1st, 2021 to May 31st, 2021

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.

Coinsmart. Beste Bitcoin-Börse in Europa
Source: https://hackernoon.com/accepting-payments-with-the-wix-payment-api-8w1335ys?source=rss

Forex

Experts at Traders Union post the Rating of the Best Forex Brokers in Pakistan in 2021

Published

on

The Traders Union and its analysts have studied dozens of brokerage companies using over 100 proprietary and objective criteria to help Pakistani traders choose from among the best Forex brokers. Based on the data obtained, an unbiased rating of the best brokers in Pakistan in 2021 was compiled. Top 10 of the Best Pakistan Forex brokersThe Top 10 Best Pakistani Forex brokers list is the regulated companies offering traders optimal trading terms and first-class customer service. Top 10 Pakistan brokerage companies:

  1. Exness. This broker offers mobile and desktop MT4 and MT5 for trading, as well as MultiTerminal and WebTrader. You can start trading by depositing only $1. Its activities are monitored by CySEC and FSA. 
  2. FBS. This broker is licensed by IFSC. It offers cent, standard, and ECN accounts, including accounts with zero spread. The maximum leverage is 1:3,000, with a spread from 0.1 pips.
  3. ICMarkets. The company offers a wide range of payment systems, with leverage up to 1:500, and tight spreads from 0.0 pips. The minimum amount to start trading with this broker is $200. Its regulators are ASIC and FSA.
  4. InstaForex. This broker is for active trading and investment under FSC’s license. The minimum deposit size is $1. You can make trades in MT4, MT5, InstaTrader, and WebTrader terminals. Access to the multi-terminal is open.
  5. Forex.com. It is part of the GAIN Capital holding, which is regulated by the FCA. When replenishing an account with $1,000 and more, the client gets spreads from 0.2 pips, as well as access to the MT4, MT5 terminal, and the proprietary Forex.com platform.
  6. OctaFX. This broker is regulated by CySEC and offers leverage up to 1:500 and spreads from 0.6 pips. The minimum deposit is $100.
  7. FXTM. The minimum deposit is $10, and the leverage is up to 1:2,000. Available platforms are MT4 and MT5. Its regulators are FCA, CySEC, FSCA, and FSC.
  8. XM. The broker offers standard and cent accounts with the most precise market spreads possible. The initial investment for entering Forex is only $5. The company is regulated by ASIC, CySEC, and IFCS. 
  9. CMC Markets. This is an FCA-controlled broker having no initial investment requirements. Registered traders navigate the Forex market using the MetaTrader4 terminal with precise floating spreads.
  10. FXCM. This is a reliable company regulated by FCA. FXCM offers favorable terms for both novice traders and professionals. You can start trading at Forex if you deposit at least $50.

List of Forex brokers by objective parameters The Traders Union experts have also published a list of the best companies based on specific criteria on the ranking page to help Pakistani traders choose a top-tier broker.Please find the following ratings in the Pakistan Best Brokers section: 

  • Companies that have more than one office in the state.
  • Brokers that allow deposits in Pakistani rupees.
  • The best brokerage companies to invest in.
  • Best brokers for novice traders from Pakistan.
  • Top companies that allow deposits into trading accounts via local banks.

Also, you can read about Forex regulation in Pakistan and study the reviews of existing clients of the Top 10 companies on the Pakistan brokers rating page. A comparative analysis of brokers using objective criteria The experts at Traders Union evaluated companies according to the following criteria when compiling a rating of brokers with the best terms for Pakistani traders: 

  • Financial (22); 
  • Economic (18); 
  • Clients (27);
  • Service (23);
  • Reputational (17). 

This research methodology helped to form the most objective Best Pakistani Forex Brokers rating

Benefits of cooperating with Traders UnionFor over 10 years, the independent Traders Union has paid its members rebates based on the spreads and provides free legal assistance and professional information materials. Today, over 300,000 traders receive affiliate payments from Traders Union for trades made on Forex. 

Continue Reading

ZDNET

AfterPay CEO believes Australia has an opportunity to be a tech talent exporter

Published

on

Anthony Eisen, co-founder and CEO of Australia’s buy now, pay later platform AfterPay, has told the audience of Macquarie Technology Summit that Australia has an opportunity to be an exporter of top tech talent.

“Australia is an incredibly attractive place where you can base global talent that don’t have limitations anymore in terms of being able to do business globally, particularly if it’s tech-based,” he said on Thursday.

“I think there’s a real opportunity to make this more of an export-style industry for our country. I think the government recognises that, and they’re doing more and more to facilitate it.”

He described that Australia’s tech talent pool is “very strong” and something that AfterPay reaps the benefit of first-hand.

“We’ve seen Australian talent, when they have the opportunity to build globally scalable platforms, just shine very strongly, particularly as Australians in our company have moved internationally with our business,” he said.

Recent statistics by Hays, however, indicated that Australia and New Zealand’s tech sector continues to suffer from a severe skills shortage, particularly as international borders remain shut.

For Eisen though, he believes distance should no longer be an excuse for why talent cannot be easily sourced.

“The tyranny of distance is lost with technology-based businesses. The most fabulous thing about the opportunity to build a platform that’s scalable is that it does transcend borders, especially when you look at what we’ve been through with COVID,” he said.  

He pointed out that AfterPay continues to run its head office out of Australia, despite operating in countries including the United States, United Kingdom, and Asia.

“We haven’t regionalised our business, we’ve globalised our business, and while we have global functions now, it’s not about concentration in a geography … and that’s why I also say Australia can be a global head office in a lot of ways,” he said. 

“The global leadership team is spread out … [and] is split between Sydney, Melbourne, San Francisco, London, and we have a core group in Asia as well, so just approaching it that way I think is quite important and something we’re trying to get better at as we grow.” 

Besides exporting tech talent, being able attract talent to Australia and see them establish companies locally is equally important, Eisen said. 

“I think as Australia gets more and more on the map, being able just to attract that experience onto our shores is really important to mix with the talent that we have here,” he said.

“Australia has now produced a whole lot of pretty fantastic global startups that have become scale ups, terrific companies … but the more and more companies from Australia that can grow in that fashion, I think it’s really leading the light.”

During his virtual Q&A, Eisen also took the opportunity to highlight that AfterPay will soon be launching Money By AfterPay, which Eisen described as where “customers will actually be able to deposit money and they’ll have savings goals, and budgeting goals, and different services that go around our platform.”

In March, AfterPay, together with Zip Co, agreed to a buy now, pay later code of practice that was developed by the Australian Finance Industry Association as a vow to be transparent and focus on the needs of the customer.

RELATED COVERAGE

Coinsmart. Beste Bitcoin-Börse in Europa
Source: https://www.zdnet.com/article/afterpay-ceo-believes-australia-has-an-opportunity-to-be-a-tech-talent-exporter/#ftag=RSSbaffb68

Continue Reading

Techcrunch

Apple to drive China revenues with search ad launch

Published

on

After launching five years ago in the United States, Apple’s search advertising service finally arrived in mainland China this week.

The feature, called Apple Search Ads, lets developers bid on an advertising slot based on users’ keyword search in the App Store, similar to how Google search ads work. JPMorgan previously estimated the giant’s annual ad revenue could top $11 billion by 2025, though the forecast didn’t have a breakdown for the search ad business.

Apple has itself been reining in on personalized advertising, letting users turn off data tracking by apps, a move that will inevitably roil the business models of Facebook and others dependent on third-party data to target ads.

China has historically been a strong market for Apple, but iPhones are increasingly losing their luster as a status symbol in the country with the rise of local offerings like Huawei. In the first quarter, however, Apple’s smartphone shipment saw a rebound thanks to Huawei’s slipping sales and the launch of the iPhone 12 family. The Chinese App Store is another important source of income for Apple.

In a five-page guideline, Apple outlines the qualifications for developers targeting ads at mainland Chinese users. There is a stack of industry-specific licenses that advertisers must obtain, which practically excludes most foreign entities from directly advertising in mainland China, as noted in a blog post by AppInChina, an agency that helps international apps launch in China. To bid for search ads in China, apps would have to find local partners with all the government approvals in place.

The requirements for apps importing goods into China, for example, include not just a general license to run value-added internet businesses but also registrations with the relevant trade and customs authorities. Apple may even start asking for these permits from apps that simply want to publish in China, wrote AppInChina, as Apple continues to enforce rules set by the Chinese government as evident from its crackdown on gaming apps.


Coinsmart. Beste Bitcoin-Börse in Europa
Source: https://techcrunch.com/2021/06/23/apple-search-ads-china/

Continue Reading

ZDNET

Telstra wins 15-year Yarra Valley Water IoT contract

Published

on

Telstra has scored itself a contract with Yarra Valley Water to provide one million industrial IoT services on its IoT network.

The contract, touted as Telstra’s largest IoT deal to date, will span over 15 years.

As part of the deal, Telstra will enable Yarra Valley Water to utilise its new cloud-based platform-as-a-service IoT connection manager (ICM), as well as its cellular low power wide area network to access IoT coverage of about 4 million square kilometre for NB-IoT and over 3 million square kilometre for LTE-M. 

Telstra industry solutions and IoT group owner Mark Chapman claimed both networks were built specifically for scaled IoT deployments, including in challenging locations such as underground where digital meters are often located.

“Instead of getting four data points a year, our IoT connection manager will now allow Yarra Valley Water to get more than 17,000 data points annually for a much more accurate, near real-time, and robust understanding of its water infrastructure,” he said.

Leveraging both, according to Telstra, would enable Yarra Valley Water to automatically receive readings in near real time from in-field sensors so that the company can proactively prevent leaks from bursting, sewer blockages from becoming spills, and notifying customers about issues on their properties so they can act quickly.

“Internet of Things devices are a game changer for the water industry. By deploying a range of different sensors into our water and sanitation networks, we can detect leaks, minimise water wastage and save our customers money,” Yarra Valley Water managing director Pat McCafferty said.

In March, Telstra teamed up with the Queensland government and the Bureau of Meteorology (BoM) to run an IoT pilot program to help local farmers gain access to more accurate weather forecasts so they can manage the effects of weather and climate change on their farms.

As part of the pilot’s first phase, 55 IoT weather stations will be deployed to existing Telstra mobile network sites, private farms, and at the Department Agriculture and Fishers’ research facilities in the Lockyer Valley, Esk, Gatton, Toowoomba, Cecil Plains, and Darling Downs areas, to gather “hyper-local” weather data.

The data collection and trial phases will run until late 2021, with Telstra saying the data will be freely available to project participants via the Telstra Data Hub.  

Back in 2018, Telstra partnered with “major water utilities” on its Digital Water Metering IoT solution in an effort to prevent water wastage and bring down customer bills. 

Telstra launched its NB-IoT network in January during CES 2018, with the company touting at the time the NB-IoT network would provide connectivity for IoT devices with smaller packets of data being sent, such as sensors in the mining, agricultural, transport, logistics, manufacturing, and industrial IoT industries.  

Related Coverage

Coinsmart. Beste Bitcoin-Börse in Europa
Source: https://www.zdnet.com/article/telstra-wins-15-year-yarra-valley-water-iot-contract/#ftag=RSSbaffb68

Continue Reading
Esports5 days ago

Select Smart Genshin Impact: How to Make the Personality Quiz Work

Esports2 days ago

Dungeons & Dragons: Dark Alliance Voice Actors: Who Voices Utaar?

Blockchain5 days ago

Bitmain Released New Mining Machines For DOGE And LTC

Blockchain2 days ago

Is Margex A Scam?

Esports4 days ago

Genshin Impact Grand Line Conch Locations

Energy3 days ago

Inna Braverman, Founder and CEO of Eco Wave Power Will be Speaking at the 2021 Qatar Economic Forum, Powered by Bloomberg

Esports2 days ago

Valorant Patch 3.00 Agent Tier List

Blockchain2 days ago

Yearn Finance (YFI) and Synthetix (SNX) Technical Analysis: What to Expect?

Blockchain5 days ago

Coinbase Co-Founder Talks DeFi, NFTs, and Crypto Regulation

Esports5 days ago

Chivalry 2 Crossplay Not Working: Is There a Fix?

HRTech1 day ago

TCS bats for satellite offices, more women in the workforce

Esports5 days ago

5 Things to Do Before Shadowlands 9.1

AI2 days ago

New Modular SaaS Platform for Financial Services Sector Launched by Ezbob, a Customer Acquisition Tech Provider

Esports2 days ago

Is Dungeons and Dragons: Dark Alliance Crossplay?

Aviation3 days ago

SAS Was The First Airline To Operate A Polar Route

Blockchain2 days ago

Cardano, Chainlink, Filecoin Price Analysis: 21 June

Blockchain5 days ago

Crypto coin to be sold at U.S supermarkets

Esports2 days ago

Ruined Pantheon Prestige Edition Splash Art, Price, Release, How to Get

Blockchain4 days ago

Amplifying Her Voice June 22, 10:45AM to June 24, 4:00PM EST BERMUDA

Aviation4 days ago

The Antonov An-124 Vs An-225: What Are The Differences?

Trending