GithubHelp home page GithubHelp logo

Comments (9)

mcohen01 avatar mcohen01 commented on June 19, 2024

Hi Boris, can you set debug: true in config.js and paste log here? Thanks!

from node-quickbooks.

bordunez avatar bordunez commented on June 19, 2024

{ request:
{ uri: 'https://transaction-qa.payments.intuit.net/v2/charges',
method: 'POST',
headers:
{ company_id: 1315192275,
'User-Agent': 'node-quickbooks: version 1.0.9',
'Request-Id': 'c081d160-a0dc-11e4-b635-078e36d5f843',
host: 'transaction-qa.payments.intuit.net',
Authorization: 'OAuth oauth_consumer_key="qyprdG9Fsh0tmtoUlgBolKbap70upJ",oauth_nonce="2b036001afae4e0fa4902277d310a1f0",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1421783071",oauth_token="qyprdDi0aSpfQkzUUXdW033jm8YLJ01U2P0nkcCShECqcnTo",oauth_version="1.0",oauth_signature="mr%2FHqcEbdhvU9wn63q8hc%2FRQ3Ls%3D"',
accept: 'application/json',
'content-type': 'application/json',
'content-length': 71 },
body: '{"amount":"25","currency":"USD","token":"t2688HVUFTIdpyQyWgwUkqHcw1U="}' } }
invoking endpoint: https://transaction-qa.payments.intuit.net/v2/charges
{ amount: '25',
currency: 'USD',
token: 't2688HVUFTIdpyQyWgwUkqHcw1U=' }
undefined

from node-quickbooks.

mcohen01 avatar mcohen01 commented on June 19, 2024

@bordunez I think the only issue was the Payments API url needed to be updated. Can you try with v 1.0.10? If you're using the sandbox you'll need to configure that either in config.js (if that's what you're using, or passing the sandbox url to the Quickbooks constructor. See the latest commits for reference.

from node-quickbooks.

bordunez avatar bordunez commented on June 19, 2024

@mcohen01 I was testing the 1.0.10 version, thanks of this, I notice that the way I was doing oauth flow was incorrect. Changed my code to the correct oauth flow, but now, I'm getting this issues from QuickBooks charge method, instead of have the charged object in the callback function, I'm getting "Invalid content type: application/json.\n", even if I modified the code of the example including in node-quickbooks with:
qbo.charge(charge, function(err, charged) {
console.log(charged.id)
})
and the behavior is the same. I'll paste the log below if it makes sense for you.

Thanks for your help.

{ request:
{ uri: 'https://merchantaccount.quickbooks.com/j/AppGateway/charges',
method: 'POST',
headers:
{ company_id: '1315192275',
'User-Agent': 'node-quickbooks: version 1.0.10',
'Request-Id': 'a6d1c0a0-a2fc-11e4-a905-6959effaafe9',
host: 'merchantaccount.quickbooks.com',
Authorization: 'OAuth oauth_consumer_key="qyprdG9Fsh0tmtoUlgBolKbap70upJ",oauth_nonce="a21db2503e044ec29bf83f9e19cf0c5e",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1422016674",oauth_token="qyprdTQpIBPv0lQbf7o7BZPtMgDIE6OHBAtti59GVPK2cGcy",oauth_version="1.0",oauth_signature="ZGF3e8ZCkN3fp9k%2FmZeC0hVPqi4%3D"',
accept: 'application/json',
'content-type': 'application/json',
'content-length': 271 },
body: '{"capture":false,"currency":"USD","amount":"42.21","card":{"exp_year":"2016","exp_month":"02","address":{"region":"CA","postal_code":"94062","street_address":"131 Fairy Lane","country":"US","city":"Sunnyvale"},"name":"Brad Smith","cvc":"123","number":"4111111111111111"}}' } }
{ response:
{ headers:
{ date: 'Fri, 23 Jan 2015 12:37:54 GMT',
server: 'Apache',
'content-length': '40',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, Intuit_tid, Authorization',
'access-control-allow-methods': 'POST, GET, OPTIONS',
connection: 'close',
'content-type': 'text/plain' },
statusCode: 400,
body: 'Invalid content type: application/json.\n' } }
invoking endpoint: https://merchantaccount.quickbooks.com/j/AppGateway/charges
{ capture: false,
currency: 'USD',
amount: '42.21',
card:
{ exp_year: '2016',
exp_month: '02',
address:
{ region: 'CA',
postal_code: '94062',
street_address: '131 Fairy Lane',
country: 'US',
city: 'Sunnyvale' },
name: 'Brad Smith',
cvc: '123',
number: '4111111111111111' } }
'Invalid content type: application/json.\n'

from node-quickbooks.

mcohen01 avatar mcohen01 commented on June 19, 2024

@bordunez sorry, I think the docs may be a bit out of date. I think the charge api has changed somewhat such that you must always deal in tokens. So your original code in the first comment was correct I believe, where you were passing the token in the charge call rather than the full card info.

from node-quickbooks.

bordunez avatar bordunez commented on June 19, 2024

@mcohen01 same thing using token instead the full card info, this issue sound like the request is not sending the correct content-type (application/json). Do you have any idea ? Or you thing the issue should be in the Intuit platform side ?

from node-quickbooks.

mcohen01 avatar mcohen01 commented on June 19, 2024

Sorry for the confusion @bordunez, I work on a different team and it's been difficult to get any help with this. I think the library may have been using an old URL. The latest version, 1.0.11, has been updated to point to the correct URL. Mind the new constructor parameter which controls whether to use the Sandbox or not (off by default).

from node-quickbooks.

bordunez avatar bordunez commented on June 19, 2024

Thanks so much @mcohen01 , now it works like a charm.

from node-quickbooks.

mcohen01 avatar mcohen01 commented on June 19, 2024

Sweet!

from node-quickbooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.