durango / authorize-net-cim Goto Github PK
View Code? Open in Web Editor NEWAuthorize.net CIM bindings for Node.JS
Authorize.net CIM bindings for Node.JS
I'm running trying to create a customer payment profile using your example, and I get an error when trying to call new Authorize.CreditCard. Authorize.CreditCard is undefined. I also copied and pasted the sample code:
var Authorize = require('auth-net-cim')
, _AuthorizeCIM = require('auth-net-cim')
, AuthorizeCIM = new _AuthorizeCIM({
api: '123',
key: '124',
sandbox: true // false
});
But I used my credentials. Am I missing a step somewhere?
Thanks!
when i call createcustomerprofile method, that time create a profile on website succesfully, but i m getting an error that 'CERT_UNTRUSTED'. so that why in reponce getting null.
I saw in the todo file that there are plans to finish the getHostedProfilePageRequest. Has there been any work done on it yet? Would you be open for a PR?
https://github.com/durango/authorize-net-cim/blob/ae29718128fb258c03c22df480c7d10b291b7f99/TODO.md
The createCustomerPaymentProfile
example in the README returns this error.
{ [AuthNetError: Authorize.net error: The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.]
message: 'Authorize.net error: The element \'payment\' in namespace \'AnetApi/xml/v1/schema/AnetApiSchema.xsd\' has incomplete content. List of possible elements expected: \'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData\' in namespace \'AnetApi/xml/v1/schema/AnetApiSchema.xsd\'.',
code: 'E00003' }
This is my code
var payment = new Types.Payment({
creditCard: new Types.CreditCard({
cardNumber: 41111111111111111,
expirationDate: '2012-01',
cardCode: 111
})
});
var paymentProfile = {
customerType: 'individual',
payment: payment
};
AuthorizeCIM.createCustomerPaymentProfile({
customerProfileId: customerId,
paymentProfile: paymentProfile
}, function(err, response){
console.log(err);
});
How do I fix this issue?
Hey there, I was wondering how to parse the response from the createCustomerProfileTransaction
request. The response I'm getting is
{
'$': {
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
xmlns: 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
},
messages: {
resultCode: 'Ok',
message: {
code: 'I00001',
text: 'Successful.'
}
},
directResponse: '1,1,1,This transaction has been approved.,RS7XSG,Y,2226525593,,,20.25,CC,auth_only,,Sean,Hill,,THE ADDRESS,THE PHONE NUMBER,,[email protected],,,,,,,,,,,,,,7387E8D182EE544B82A4AC96334F4D63,,2,,,,,,,,,,,XXXX4242,Visa,,,,,,,,,,,,,,,,'
}
I would like the transaction id out of this, which I believe is 2226525593
. Do I just need to run some crazy regex like
directResponse.match(/\d\d\d\d\d\d\d\d\d\d/)
?
Thanks for any help
We recently have ran into issues because it seems that the XML API has changed on AuthorizeNet's side. I'm not sure if more changes need to be made to the other projects (durango/authorize-net-types and durango/authorize-net-request)?
It looks like the code responsible for generating the xml needs to be updated to comply with their new api?
http://developer.authorize.net/api/reference
<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>API_LOGIN_ID</name>
<transactionKey>API_TRANSACTION_KEY</transactionKey>
</merchantAuthentication>
<refId>123456</refId>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>5</amount>
<payment>
<creditCard>
<cardNumber>5424000000000015</cardNumber>
<expirationDate>1220</expirationDate>
<cardCode>999</cardCode>
</creditCard>
</payment>
<order>
<invoiceNumber>INV-12345</invoiceNumber>
<description>Product Description</description>
</order>
<lineItems>
<lineItem>
<itemId>1</itemId>
<name>vase</name>
<description>Cannes logo </description>
<quantity>18</quantity>
<unitPrice>45.00</unitPrice>
</lineItem>
</lineItems>
<tax>
<amount>4.26</amount>
<name>level2 tax name</name>
<description>level2 tax</description>
</tax>
<duty>
<amount>8.55</amount>
<name>duty name</name>
<description>duty description</description>
</duty>
<shipping>
<amount>4.26</amount>
<name>level2 tax name</name>
<description>level2 tax</description>
</shipping>
<poNumber>456654</poNumber>
<customer>
<id>99999456654</id>
</customer>
<billTo>
<firstName>Ellen</firstName>
<lastName>Johnson</lastName>
<company>Souveniropolis</company>
<address>14 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</billTo>
<shipTo>
<firstName>China</firstName>
<lastName>Bayles</lastName>
<company>Thyme for Tea</company>
<address>12 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</shipTo>
<customerIP>192.168.1.1</customerIP>
<!-- Uncomment this section for Card Present Sandbox Accounts -->
<!-- <retail><marketType>2</marketType><deviceType>1</deviceType></retail> -->
<transactionSettings>
<setting>
<settingName>testRequest</settingName>
<settingValue>false</settingValue>
</setting>
</transactionSettings>
<userFields>
<userField>
<name>MerchantDefinedFieldName1</name>
<value>MerchantDefinedFieldValue1</value>
</userField>
<userField>
<name>favorite_color</name>
<value>blue</value>
</userField>
</userFields>
</transactionRequest>
</createTransactionRequest>
This library defines transaction types as
this.transactionTypes = [
'AuthOnly', 'AuthCapture',
'CaptureOnly', 'PriorAuthCapture',
'Refund', 'Void'
];
But in the createCustomerProfileTransaction
this line of code prevents Refund
or Void
requests.
if (transactionType !== "AuthCapture" && transactionType !== "AuthOnly" && transactionType !== "CaptureOnly" && transactionType !== "PriorAuthCapture") {
throw new Error('Invalid transactionType. Must be: AuthCapture, AuthOnly, CaptureOnly, or PriorAuthCapture');
}
This could be fixed by this code
if (this.transactionTypes.indexOf(transactionType) === -1) {
throw new Error('Invalid transactionType. Must be: ' + this.transactionTypes.join(', '));
}
@durango if this could be fixed that'd be great!
Hi!
In one of our customer cases, the initial credit card transaction is first done to Authorize.net and only after the successful transaction, the payment profile is created based on that transaction. i.e. I'd need an interface to the Authorize.net CIM createCustomerProfileFromTransaction call.
Since we need that ASAP, we'll work on that on a fork and let you know once we're done.
-Mikael
Do you have any ideas where to find a walk through when using this software, and Authorize.net CIM in a node application?
This is just a nit, but one to be aware of, xml2json requires building c++ code and uses node-gyp. It's a bit heavy on requirements on the windows side.
xml2js does not have those heavy requirements, but, it does have lodash, which means waiting for about 30 seconds during npm install as lodash-node is a bit of an inefficient repo.
auth-net-request 2.0.0 does not account for chunking making any response that is to large makes the your app crash because it attempts to parse an uncompleted XML response.
auth-net-request 2.1.0 Fixes this issue so I recommend updating the packages to fix this issue.
I can't find a way to set the validationMode on createCustomerPaymentProfile, if I pass it in as an option, i see it is passed to AuthorizeRequest.send as xmloptions, but the code in AuthorizeRequest.send doesn't use the value.
I was able to repro the behavior in a test here:
https://gist.github.com/lkobashigawa/4a0c35ce4d729323d598#file-gistfile1-js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.