I am trying to authorize orders on the 2checkout sandbox, it was working fine but suddenly it stopped. Now I am always getting:
Payment Authorization Failed: Please verify your information and try
again, or try another payment method.
var tco = new Twocheckout({
sellerId: "1234456688", //on my code I am sending my true seller id
privateKey: "XXXXXXX-XXXXXX-XXXXXX", //on my code I am sending my key
sandbox: true
});
var plan = SubscriptionService.getPlan(req.body.plan);
if(plan) {
var params = {
"merchantOrderId": new Date().valueOf()+"",
"token": req.body.token,
"currency": "USD",
"tangible": "N",
"lineItems": [
{
"name": plan.name,
"price": plan.price,
"type": "product",
"quantity": "1",
"productId": plan.id,
"recurrence": "1 Month",
"duration": "Forever",
"description": ""
}],
"billingAddr": {
"name": req.body.ccName,
"addrLine1": req.body.streetAddress,
"city": req.body.city,
"state": req.body.state,
"zipCode": req.body.zip,
"country": req.body.country,
"email": req.user.email,
"phoneNumber": "5555555555"
}
};
tco.checkout.authorize(params, function (error, data) {
if (error) {
res.send(error);
} else {
res.send(data.response);
}
});
}
}
this is the example of a json I am sending
{ merchantOrderId: '1494967223074',
token: 'ZTFiNmFkMjktZWNmMi00NjlhLWE0MDAtZmJkMGJlYjU5M2Q1',
currency: 'USD',
tangible: 'N',
lineItems:
[ { name: 'pro plan',
price: '149.00',
type: 'product',
quantity: '1',
productId: '002',
recurrence: '1 Month',
duration: 'Forever',
description: '' } ],
billingAddr:
{ name: 'Testing Tester',
addrLine1: '123 Main Street',
city: 'Townsville',
state: 'ohio',
zipCode: '43206',
country: 'USA',
email: 'victor.eloy#landmarkwebteam.com',
phoneNumber: '55555555' } }
If I go to my account >> site management and set demo to true I manage to get authorizations from the sandbox but the orders do not get logged to the sandbox. Previously even when the demo mode was off I managed to get the orders authorized but now I don't know what is happening.
here comes a log from one order:
I have the exact same problem. Just 4 days ago the code was working fine. I'm assuming it's something from 2checkout not from our code..
Only thing I can see is you are attempting to parse
"zipCode": req.body.zip
but you are sending
zipCode: '43206'
I assume this should be parsed as req.body.zipCode
Related
When I try to set up a test, Stripe connect account on the backend and skip onboarding, I run into address and identity verification issues. How can I resolve these?
Background: for testing backend features other than Stripe onboarding, it would be helpful to set up a test Stripe connect account that has completed onboarding. There are other answers here indicating that there is no one-call process to complete that, but it's not clear exactly what the steps are.
Below I try to complete this in 3 steps; but I am running into an issue: the address is unverified even though I'm using the address 'token' that the documentation says will automatically verify.
My steps:
Create an account token
Create a bank_account token
Create an account, using those tokens
Result: when I check the account after a few seconds (I wait 10 seconds for verification) I get:
account.payouts_enabled: true
account.charges_enabled: true
account.currently_due: [
"individual.address.line1"
]
account.past_due: []
account.eventually_due: []
account.disabled_reason: requirements.pending_verification
account.pending_verification: [
'individual.address.city',
'individual.address.line1',
'individual.address.postal_code',
'individual.address.state',
'individual.id_number'
]
The problem: why is the address line marked "currently_due" (when I'm using the documented token "address_full_match") and address verification incomplete? Additionally, why is the individual.id_number pending verification (when I'm using the documented token "222222222")?
Code below, using the Stripe Node API:
const accountToken = await stripe.tokens.create({
account: {
business_type: 'individual',
individual: {
first_name: 'Jenny',
last_name: 'Rosen',
// https://stripe.com/docs/connect/testing
// Use these addresses for line1 to trigger certain verification conditions. You must pass in legitimate values for the city, state, and postal_code arguments.
// address_full_match Successful verification.
// address_no_match Unsuccessful verification.
address: {
line1: 'address_full_match',
city: 'Columbus',
state: 'OH',
postal_code: '43214',
// country: 'US'
},
// https://stripe.com/docs/connect/testing#test-dobs
// 1901-01-01 Successful verification. Any other DOB results in unsuccessful verification.
// 1902-01-01 Successful, immediate verification. The verification result is returned directly in the response, not as part of a webhook event.
// 1900-01-01 This DOB will trigger an Office of Foreign Assets Control (OFAC) alert.
dob: {
day: 1,
month: 1,
year: 1902
},
// https://stripe.com/docs/connect/testing
// Use these personal ID numbers for individual[id_number] or the id_number attribute on the Person object to trigger certain verification conditions.
// 000000000 Successful verification. 0000 also works for SSN last 4 verification.
// 111111111 Unsuccessful verification (identity mismatch).
// 222222222 Successful, immediate verification. The verification result is returned directly in the response, not as part of a webhook event.
id_number: '222222222',
// ssn_last_4: '0000',
email: 'jenny.rosen#example.com',
phone: '000 000 0000'
},
tos_shown_and_accepted: true,
},
});
const bankAccountToken = await stripe.tokens.create({
bank_account: {
country: 'US',
currency: 'usd',
account_holder_name: 'Jenny Rosen',
account_holder_type: 'individual',
routing_number: '110000000',
account_number: '000123456789',
},
});
const account = await stripe.accounts.create({
type: 'custom',
country: 'US',
business_profile: {
mcc: '5734', // Merchant Category Code. 5734 = Computer Software Stores
product_description: 'Cool Beans, Inc',
},
external_account: bankAccountToken.id,
capabilities: {
card_payments: {
requested: true,
},
transfers: {
requested: true,
},
},
account_token: accountToken.id,
});
Here's the config that works for me:
async function createTestStripeAccount() {
return await stripe.accounts.create({
type: 'custom',
country: 'US',
capabilities: {
card_payments: { requested: true },
transfers: { requested: true }
},
business_type: 'individual',
external_account: {
object: 'bank_account',
country: 'US',
currency: 'usd',
routing_number: '110000000',
account_number: '000123456789'
},
tos_acceptance: { date: 1609798905, ip: '8.8.8.8' },
business_profile: { mcc: 5045, url: 'https://bestcookieco.com' },
individual: {
first_name: 'Test',
last_name: 'User',
phone: '+16505551234',
email: 'test#example.com',
id_number: '222222222',
address: {
line1: '123 State St',
city: 'Schenectady',
postal_code: '12345',
state: 'NY'
},
dob: {
day: 10,
month: 11,
year: 1980
}
}
})
}
I've managed to set it up today for my client in sandbox and production.
PHP version with using the official library SDK from stripe.
composer require stripe/stripe-php
At the time of this writing the above version of stripe/stripe-php is exactly v9.6.0
<?php
\Stripe\Stripe::setApiKey('yourSandbox-STRIPE_SECRET_KEY-Here');
\Stripe\Account::create([
"type" => "custom",
"country" => "GB",
"capabilities" => [
"card_payments" => [
"requested" => true,
],
"transfers" => [
"requested" => true,
],
],
"business_type" => "individual",
"external_account" => [
"object" => "bank_account",
"country" => "GB",
"currency" => "gbp",
"account_number" => "00012345",
],
'tos_acceptance' => ['date' => 1609798905, 'ip' => '8.8.8.8'],
"business_profile" => [
"mcc" => 5045,
"url" => "https://exmple.com",
],
"individual" => [
"first_name" => "Test",
"last_name" => "User",
"phone" => "+16505551234",
"email" => "test#example.com",
"id_number" => "222222222",
"address" => [
"line1" => "123 State St",
"city" => "London",
"postal_code" => "TF5 0DL",
],
"dob" => [
"day" => 01,
"month" => 01,
"year" => 1901,
],
],
]);
I hope it will help somebody to save some time. Cheers and good luck.
References:
https://stripe.com/docs/connect/custom-accounts#create
https://stripe.com/docs/connect/testing#identity-and-address-verification
https://stripe.com/docs/connect/updating-accounts
You have to add document field as well for upload document to make the account active for testing purpose.
const account = await stripe.accounts.create({
type: "custom",
country: "US",
capabilities: {
card_payments: { requested: true },
transfers: { requested: true },
},
business_type: "individual",
external_account: {
object: "bank_account",
country: "US",
currency: "usd",
routing_number: "110000000",
account_number: "000123456789",
},
tos_acceptance: { date: new Date(), ip: "8.8.8.8" },
business_profile: { mcc: 5045, url: "https://bestcookieco.com" },
individual: {
first_name: "custom_user",
last_name: "one",
phone: "+16505551234",
email: "custom_user1#yopmail.com",
id_number: "222222222",
address: {
line1: "address_full_match",
city: "Schenectady",
postal_code: "12345",
state: "NY",
},
dob: {
day: 01,
month: 01,
year: 1901,
},
verification: {
document: {
front: "file_identity_document_success",
},
},
},
});
I can't get the result of a resolved promise inside the export default section.
Hi devs, I'm new to JavaScript and I'm having trouble with promises and export default section. I'm hashing a password but I can't get the value inside my users' array object. I can get the password on my console though, and I want to use that array in my controllers to populate it with other users using postman.
My userModel module that I'm importing in my controllers.
import hasher from '../helpers/password';
const adminPassword = async () =>{
const hashedPwd = await hasher.hashingPassword('john124', 10);
console.log(hashedPwd);
return hashedPwd;
};
export default [
{
id: 1,
first_name: 'john',
last_name: 'doe',
email: 'john#gmail.com',
password: adminPassword(),
address: 'kigali',
is_admin: true
}
]
Response body from Postman
{
"status": 200,
"message": "Successfully Signed Up",
"data": [
{
"id": 1,
"first_name": "john",
"last_name": "doe",
"email": "john#gmail.com",
"password": {},
"address": "kigali",
"is_admin": true
},
{
"id": 2,
"email": "james#gmail.com",
"first_name": "james",
"last_name": "mes",
"password": "$2a$10$XXCc4oMwawyWZMzJJdUyq.Z.l9YobO3jicg6x7qNN/v7.94c9qVg.",
"address": "kinshasa",
"is_admin": false
}
]
}
Console output
[ { id: 1,
first_name: 'john',
last_name: 'doe',
email: 'john#gmail.com',
password:
Promise {
'$2a$10$a575M8tm1b8QdkH./V0zSuxGUV43OapBzehXyH9CkpypqAr0hmsPK' },
address: 'kigali',
is_admin: true } ]
How can I get just the hashed string as my password? Thank you in advance.
exports are handled synchronously. It's not possible to do this immediately. You could have an export eventually turn into a hashed password (and possibly have it return null first), but this would be a pretty bad approach.
The sane way to do this is to not return an object, but to return a promise that resolves into your full object:
const result = adminPassword.then( hash => {
return {
id: 1,
first_name: 'john',
last_name: 'doe',
email: 'john#gmail.com',
password: hash,
address: 'kigali',
is_admin: true
};
});
export default result;
i use Express-js and express graphQL module to create my endpoint and web service ;
i am looking for way to create custom response in graphQL my endpoint is simple
select books from database my response is
{
"data": {
"books": [
{
"id": "5b5c02beab8dc1182b2e0a03",
"name": "dasta"
},
{
"id": "5b5c02c0ab8dc1182b2e0a04",
"name": "dasta"
}
]
}
}
but in need something like this
{
"result": "success",
"msg" : "list ...",
"data": [
{
"id": "5b5c02beab8dc1182b2e0a03",
"name": "dasta"
},
{
"id": "5b5c02c0ab8dc1182b2e0a04",
"name": "dasta"
}
]
}
here is my bookType
const BookType = new GraphQLObjectType({
name: 'Book',
fields: () => ({
id: {type: GraphQLID},
name: {type: GraphQLString},
genre: {type: GraphQLString},
author_id: {type: GraphQLString},
author: {
type: AuthorType,
resolve(parent, args) {
return Author.findById(parent.author_id);
}
}
})
});
That's not a legal GraphQL response. As per section 7.1 of the spec, after describing the data, errors, and extensions: top-level keys:
... the top level response map must not contain any entries other than the three described above.
You might put this data into extensions; or make it an explicit part of your GraphQL API; or simply let "success" be implied by the presence of a result and the lack of an error.
I am using passport-linkedin-oauth to connect to linkedin from node.js. I am getting results in the format :
{ provider: 'linkedin',
id: 'd8UCzVLeQ4',
displayName: 'Sunanda Saha',
name: { familyName: 'Saha', givenName: 'Sunanda' },
emails: [ { value: 'sunanda.saha90#gmail.com' } ],
photos:
[ { value: 'https://media.licdn.com/dms/image/C4D03AQFrIK2nFzHrCA/profile-displayphoto-shrink_100_100/0?e=1535587200&v=beta&t=uSLIk3r-gZ8yxdKK_X3g8M1a4usPXmkLbQbyhvhwu0w' } ],
_raw: '{\n "apiStandardProfileRequest": {\n "headers": {\n "_total": 1,\n "values": [{\n "name": "x-li-auth-token",\n "value": "name:Hhbi"\n }]\n },\n "url": "https://api.linkedin.com/v1/people/d8UCzVLeQ4"\n },\n "distance": 0,\n "emailAddress": "sunanda.saha90#gmail.com",\n "firstName": "Sunanda",\n "formattedName": "Sunanda Saha",\n "headline": "Student at National Institute of Technology Durgapur",\n "id": "d8UCzVLeQ4",\n "industry": "Computer Hardware",\n "lastName": "Saha",\n "location": {\n "country": {"code": "in"},\n "name": "Durgapur Area, India"\n },\n "numConnections": 43,\n "numConnectionsCapped": false,\n "pictureUrl": "https://media.licdn.com/dms/image/C4D03AQFrIK2nFzHrCA/profile-displayphoto-shrink_100_100/0?e=1535587200&v=beta&t=uSLIk3r-gZ8yxdKK_X3g8M1a4usPXmkLbQbyhvhwu0w",\n "pictureUrls": {\n "_total": 1,\n "values": ["https://media.licdn.com/dms/image/C4D00AQHRGUNS3tX9nA/profile-originalphoto-shrink_900_1200/0?e=1530086400&v=beta&t=OpBcFgQZf3T6itjXiRUruXYwBmJ0E-Lth3Vk-HwSMT8"]\n },\n "positions": {"_total": 0},\n "publicProfileUrl": "https://www.linkedin.com/in/sunanda-saha-b02098144",\n "relationToViewer": {"distance": 0},\n "siteStandardProfileRequest": {"url": "https://www.linkedin.com/profile/view?id=AAoAACLlVTIBohmGBTmRaxEcHqMt7a-RpvQakIE&authType=name&authToken=Hhbi&trk=api*a5259465*s5577785*"}\n}',
_json:
{ apiStandardProfileRequest:
{ headers: [Object],
url: 'https://api.linkedin.com/v1/people/d8UCzVLeQ4' },
distance: 0,
emailAddress: 'sunanda.saha90#gmail.com',
firstName: 'Sunanda',
formattedName: 'Sunanda Saha',
headline: 'Student at National Institute of Technology Durgapur',
id: 'd8UCzVLeQ4',
industry: 'Computer Hardware',
lastName: 'Saha',
location: { country: [Object], name: 'Durgapur Area, India' },
numConnections: 43,
numConnectionsCapped: false,
pictureUrl: 'https://media.licdn.com/dms/image/C4D03AQFrIK2nFzHrCA/profile-displayphoto-shrink_100_100/0?e=1535587200&v=beta&t=uSLIk3r-gZ8yxdKK_X3g8M1a4usPXmkLbQbyhvhwu0w',
pictureUrls: { _total: 1, values: [Array] },
positions: { _total: 0 },
publicProfileUrl: 'https://www.linkedin.com/in/sunanda-saha-b02098144',
relationToViewer: { distance: 0 },
siteStandardProfileRequest:
{ url: 'https://www.linkedin.com/profile/view?id=AAoAACLlVTIBohmGBTmRaxEcHqMt7a-RpvQakIE&authType=name&authToken=Hhbi&trk=api*a5259465*s5577785*' } } }
To get the information I am using
newUser.linkedin.name = profile.displayName;
newUser.linkedin.email = profile.emailAddress;
newUser.linkedin.location = profile.location;
I am getting the name but not email and location. How to get the other two. And also the gender.
According to the json you provided it should give you your required info in the following formate.
newUser.linkedin.name = jsonYouGave.formattedName;
newUser.linkedin.email = jsonYouGave.emailAddress;
newUser.linkedin.location = jsonYouGave.location.name;
jsonYouGave is the json which you updated in your answer.
I am using Braintree's Node.js SDK we got an issue regarding account number it accept garbage vale like that 11235***sdfsf**81321 which is wrong. Can anyone help? Braintree validation how to wrok?
merchantAccountParams = {
individual: {
firstName: "Jane",
lastName: "Doe",
email: "jane#14ladders.com",
phone: "5553334444",
dateOfBirth: "1981-11-19",
ssn: "456-45-4567",
address: {
streetAddress: "111 Main St",
locality: "Chicago",
region: "IL",
postalCode: "60622"
}
},
business: {
legalName: "Jane's Ladders",
dbaName: "Jane's Ladders",
taxId: "98-7654321",
address: {
streetAddress: "111 Main St",
locality: "Chicago",
region: "IL",
postalCode: "60622"
}
},
funding: {
descriptor: "Blue Ladders",
destination: braintree.MerchantAccount.FundingDestination.Bank,
email: "funding#blueladders.com",
mobilePhone: "5555555555",
accountNumber: "11235***sdfsf**81321",
routingNumber: "071101307"
},
tosAccepted: true,
masterMerchantAccountId: "14ladders_marketplace",
id: "blue_ladders_store"
};
gateway.merchantAccount.create(merchantAccountParams, function (err, result) {
});
We can validate the user input from our client side, then we can send a valid value to BrainTree. Account number validation result, we will get only after sending values to BrainTree, they will provide the result in their objects(using BrainTree dll) as a response value.
Please refer this article for more details.