
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@deshartman/payclient
Advanced tools
Simple Twilio Agent Assisted Payment library to capture credit cards for tokens
Twilio PayClient is a proof of concept implementation of Twilio's Pay service, offering PCI DSS payment capture on Twilio voice calls. Visit the official site for more details: https://www.twilio.com/pay
npm install --save @deshartman/payclient
Using this method, you can use payclient.js like so:
import PayClient from "@deshartman/payclient";
const payClient = new PayClient(merchantURL, identity);
payclient.attachPay(callSid);
The client has multiple methods that can be used to drive a user interface. Some examples are given below:
payClient.startCapture();
payClient.cancelCapture();
payClient.submitCapture();
payClient.resetCard();
payClient.resetSecurityCode();
payClient.resetDate();
payclient.updateCallSid(callSid);
The client has multiple events that fire and can be used to drive a User interface. Some examples are given below:
payClient.on('callConnected', (callSid) => {
payClient.updateCallSid(callSid);
});
payClient.on('cardUpdate', (data) => {
this.paymentCardNumber = data.paymentCardNumber;
this.paymentCardType = data.paymentCardType
this.securityCode = data.securityCode
this.expirationDate = data.expirationDate
this.paymentToken = data.paymentToken
};
payClient.on('capturing', () => { });
payClient.on('capturingCard', () => { });
payClient.on('capturingSecurityCode', () => { });
payClient.on('capturingDate', () => { });
payClient.on('captureComplete', () => { });
payClient.on('cardReset', () => { });
payClient.on('securityCodeReset', () => { });
payClient.on('dateReset', () => { });
payClient.on('cancelledCapture', () => { });
payClient.on('submitComplete', () => { });
payclient.updateCallSid(callSid);
Note: If a mistake was made entering digits, call the resetXXX() methods to reset the entry.
To use the library, you need to provide config back to the client via a server url, where the configuration can be pulled from in the below format.
const config = {
twilioAccountSid: context.ACCOUNT_SID,
twilioApiKey: context.API_KEY,
twilioApiSecret: context.API_SECRET,
functionsURL: 'https://' + context.DOMAIN_NAME, // The Twilio Functions URL. Server where "paySyncUpdate" is deployed (See server below)
payConnector: context.PAY_CONNECTOR, // The name of the Twilio Pay connector configured
paySyncServiceSid: context.PAY_SYNC_SERVICE_SID, // Sync ServiceSid. All maps will be created
captureOrder: [ // example order of keywords.
"payment-card-number",
"security-code",
"expiration-date",
],
currency: 'AUD', // USD is default
tokenType: 'reusable', // one-time || reusable
};
This can be done with any server, or for convenience, deploy the server using twilio Functions, pasting the code below into Functions and setting the Environment variables.
Create an API Key/secret to use with the services. Update the server "agent-pay-server/.env" with details.
Create a Twilio Sync Service and update PAY_SYNC_SERVICE_SID in "agent-pay-server/.env"
Create a new Pay connector and note the name of the connector. Update PAY_CONNECTOR in "agent-pay-server/.env"
Deploy the Server side with "twilio serverless:deploy". Use the Functions URL for the Merchant Server URL in PayClient.
FAQs
Simple Twilio Agent Assisted Payment library to capture credit cards for tokens
We found that @deshartman/payclient demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.