how to create usdt wallet via api and receive transactions - node.js

I'm new to this area and don't understand anything yet. I need to create a USDT wallet and accept it into payments, but I need to confirm the payment based on recent transactions.
I can't find anything that can solve my problem in Google.
On the server side, I usually use node js, maybe there are some packages?

Currently, there are two most popular .js libraries for the matter you want to achieve - web3.js and Ethers.js.
I would recommend you to dig into one of those.
Shortly:
Connect to the Ethereum network https://web3js.readthedocs.io/en/v1.2.0/web3.html#web3-object
Create a contract entity (USDT) in order to interact with the wanted contract
https://web3js.readthedocs.io/en/v1.2.0/web3-eth-contract.html
For wallet creation
https://web3js.readthedocs.io/en/v1.2.0/web3-eth-accounts.html?highlight=wallet#wallet-create
In order to confirm the payments in erc-20 you would like to subscribe to the blockchain events (this will help you to catch wanted transactions):
https://web3js.readthedocs.io/en/v1.2.0/web3-eth-subscribe.html#

Related

Best way to handle one-time payments with STRIPE webhooks in nodeJS

I am using STRIPE as my payment processor, in an REACT + nodeJS app. I already have something that already works, but I would like some feedback, maybe I'm doing something wrong.
So... I have this Redirect-To-Checkout functionality thats made available by STRIPE, basically I redirect the user to this STRIPE page where all card-data (sensitive information) is processes in order for the payment to full-fill.
What I do in my nodeJS server part is the following:
Once the user acces the redirect to check-out page, I already create a PendingOrder, with the products selected by client (Here I save some information based on client/stripe payment-intent, in order to check in later steps)
Once webhook gives me the 'payment_intent.succeeded' I check for the payment-intent information to see if it exists in my PendingOrder collection, then proceed to add in to ConfirmedOrders and remove it from PendingOrders.
I have to do this whole process because Stripe no longer gives me access to some information I require when the user is checking-out his order(such as observation that the user has based on the type of service he chooses).
Are there any down-sides to this approach or is there any other way to do it?
Thanks in advance!
You’re not really far from the best practices that Stripe recommends here. The only thing that I would change is listening to checkout.session.completed instead of the payment_intent.succeeded event. As of the latest API version, a PaymentIntent is no longer created upfront so a better to way to handle order fulfillment is to either store the Checkout Session ID (e.g. cs_live_xxx) or you could add some metadata when creating the Checkout Session and use that instead to identify the order.
I have to do this whole process because Stripe no longer gives me access to some information I require when the user is checking-out his order
As for this, I’m not sure what you mean, you can always use your app with the success page customization described here alongside webhooks. I wouldn’t use that to fulfill the order though since the user might close the page before the redirection completes which means that the fulfillment wouldn’t be done in that case. As such, webhooks are essential to order fulfillment.

Sending PCI data through Node.js (authorize.net)

A client has asked me to set-up card payments through authorize.net. However, I've noticed the node SDK hasn't been updated in a year and their Node SDK is only mentioned on some of their doc pages (so I get the impression it's not a primary focus for them).
I have many years of experience using Braintree Payments and Stripe. They both have great support for Node, plus drop-in/hosted fields for React (frontend). This approach removed much of the PCI compliance requirements from my server.
However, my client cannot use Braintree or Stripe because they are selling restricted items which are not allowed by Braintree's and Stripe's ToS. They currently use Authorize.net and would like me to continue to support that on their new website.
It seems my only option is to directly send card details from my React frontend to my Node API server. Which makes me uncomfortable. As Stripe's PCI guide says there are 300+ security controls in PCI DSS which need to be met if send PCI data on servers.
Here is an example of their creditCard inputs on Node, taken from their examples GitHub repo.
var creditCard = new ApiContracts.CreditCardType();
creditCard.setCardNumber('4242424242424242');
creditCard.setExpirationDate('0822');
creditCard.setCardCode('999');
var paymentType = new ApiContracts.PaymentType();
paymentType.setCreditCard(creditCard);
My question is:
It doesn't seem the best practice in 2020 to send card details through my server anymore with so many providers out there offering hosted fields. Is this a valid concern?
Would I need to get my Node.js code and PCI compliance validated by QSA?
more link:
Node.js SDK: https://github.com/AuthorizeNet/sdk-node
Their PCI compliance list (last updated three years ago?):
Hey I believe that the accept.js suite would be what you need. https://developer.authorize.net/api/reference/features/acceptjs.html Basically it takes a payment nonce after receiving your post request from the client side and sends it to your server instead of sensitive credit card in formation. I am trying to work with it myself. Maybe we could collaborate. I'm a node payment novice. I posted a question about it here.
I would like to automatically hit an api with dynamic values from my client side via a post request using javascript files. How can I achieve this?
let me know if this helps
While writing this question I found out that someone had the same concern as me in PHP/Magento in another Stack Overflow post.
Using Authorize.net's Accept.js you can send payment details directly to their servers and use a payment nonce (like Braintree/Stripe) in place of the card details.
Accept.js is a JavaScript library for sending secure payment data
directly to Authorize.Net. Accept.js captures the payment data and
submits it directly to us, in exchange for a one-time-use token, or
payment nonce. You can use this payment nonce in the place of payment
data in a follow-on createTransactionRequest API call.
Our JavaScript library offers developers two workflow options for
accepting payment:
Option 1: Host your own payment form for a PCI-DSS SAQ A-EP solution that gives you complete control of the customer payment experience.
Option 2: Embed our hosted, mobile-optimized payment information form in your page to collect the card information in a PCI-DSS SAQ A
compliant way. For a fully hosted payment solution that you can
redirect your customers to or embed as an iFrame within your page, see
our documentation for Accept Hosted.

Google Hangouts Chatbot Create Room

I am writing service for messaging between rooms using Hangouts chatbot. Is it possible to create a room with Hangouts chatbot?
https://developers.google.com/hangouts/chat/concepts
If it were generally possible to create a new room programmaticaly with the Hangous API, you could do it with the chatbot.
For example, if you implement the chatbox with Apps Script, you can create a function onMessage(event) and establish was will to happen in case of a certain event.message.text (e.g. create a new chat room if the message text contains the string create new room.
However, for the moment it is not possible to create a new chat room programmatically.
There is a feature request asking for this functionality, but given the potential of abuse, it is controversial either it will be implemented.
See comment #2:
Hello, thank you for the feature request! At the moment rooms cannot
be created via the API to prevent abuse such as a bot or script
spamming room creation. However, this kind of feature has been
discussed internally and may be coming in the future (with
limitations). I will update this issue if more information is
released.
And comment #25:
Thanks for the input. It's great to see some real life use cases. We
fully acknowledge the importance of a CreateRoom(DM) API and we are
actively looking into the right permission model to allow bots to do
so. Please continue to follow this bug as we will post updates here
when appropriate.

Creating a conference on Asterisk using ARI with Node.js

I was given a task to create a conference in Asterisk using ARI with Node.js. The objective is create a conference room and send email invitations so people can click and enter de conference room. I also need a admin web interface to show who's talking, mute and some other things.
I don't have any experience in Asterisk. So I need some start point. Innitally I have to create a Channel and then add some SIP to it.
So taking this page as a base: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Channels+REST+API
I have a configured test server and a sip number (852001). So I opened up Insomnia and create a POST request like this:
http://<serverip>:8088/ari/channels/400?endpoint=852001&extension=400
But allocation failed. So I thought that before I continue with this I have to make some concepts clear:
What do I need to create a conference room ? It's just create a channel or I have to create a bridge first ? What should be the right values in endpoint, extension or app fields ?
Is ARI URLs the best approach or it's better to use node.js's ari-client module ? I'm using urls because I couldn't get any working example on creating a conference with ari-client.
Any code examples on how I could do this would be greatly appreciated. Thanks.
Read Orelly's "Asterisk the future of telephony" as starting point.
ps but do it via ARI only seams like impossible even for expert. Anyway you need some dialplan.

Creating new payment method for Bigcommerce

I would like to know if this is possible to add new payment method for Bigcommerce. I tried to contact their support without any luck. If anyone is familiar with bigcommerce and know if this is possible, i would appreciate any advice.
I already read their API docs and didn't found anything useful - only method to obtain list of available payment methods.
I already tried to signup for their partner. Without any luck.
We've done this before for a couple stores to allow clients to process payments through their own processor. The way we achieved this, is essentially through the following high-level steps:
Allow payments by Check (or similar offline method). We are going to replace this with the custom processor.
You'll notice that if you attempt to checkout via Check, that BigCommerce automatically creates the order for you, but sets the order status to Awaiting Payment. Upon submission the user is automatically sent to a 'Thank You' Order Confirmation page that contains both the Order ID and some payment instructions (such as where to send the check to).
Here's the trick -- Modify this 'Order Thank You' page to prompt the user for her or his credit card information. A simple HTML form will suffice here, performing the actual request via JavaScript.
Once you have the user's credit card data, you can then POST it to your own external server, where you would connect to and send data to whichever processor you are using. Additionally, you should make sure to send the Order ID to this program, so that you can connect to the BigCommerce API to load billing information, and then subsequently adjust the order status to either approved or declined depending on the response from your processor. Finally, you should send back some sort of response to the client to inform of the result of the charge attempt.
That's pretty much it in a nutshell. The way you integrate with the payment processor (step 4) is unique to whichever processor you are using. I hope this makes sense.
Although opinion based, I'm a huge fan of serverless technologies, and would suggest looking into AWS Lambda + AWS API Gateway. The benefit here is that you don't need to worry about creating an infrastructure or the associated concerns of security and scale. Rather, AWS Lambda allows you to simply upload your software, and allows it to be executed via an HTTP request to some defined endpoint set through the API Gateway. Lambda will scale automatically for you, and you don't need to worry about system level security concerns - only security at the application level. It's truly a set and forget setup, and a bleeding edge technology. Not to mention dirt cheap!
Implementing a new payment method is unsupported and requires hacky workarounds since we implement payment gateways via the core app. You can do this on blueprint by using an offline payment method and then using the API to update payment statuses, etc. I'd recommend using ActiveMerchant if you do wish to go down this path.

Resources