Related
Contact Object from getContact SDK:
Contacts {
contacts: [
Contact {
contactID: xxxx,
firstName: yyyy,
lastName: zzzz,
etc...
}
]
}
Contact Object from API 'https://api.xero.../Contacts/ctid' itself :
{
Id: xxxx,
Status: xxxx,
...
Contacts: [
{
ContactID: xxxx,
FirstName: yyyy,
LastName: zzzz,
etc...
}
]
}
Everything is different: structure, fieldNames, etc
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'm allowing credit card payment with paypal smart buttons. This is how my createOrder looks like:
createOrder: function(data, actions) {
paypalActions = actions;
return fetch('/basket/get/lineitems', {
method: 'get'
}).then(function(res) {
return res.json();
}).then(function(orderData) {
orderDataArray = [orderData]
return actions.order.create({
payer: {
name: {
given_name: "PayPal",
surname: "Customer"
},
address: {
address_line_1: '123 ABC Street',
address_line_2: 'Apt 2',
admin_area_2: 'San Jose',
admin_area_1: 'CA',
postal_code: '95121',
country_code: 'US'
},
email_address: "customer#domain.com",
phone: {
phone_type: "MOBILE",
phone_number: {
national_number: "12345678"
}
}
},
purchase_units: orderDataArray,
shipping_type: 'PICKUP',
application_context: { shipping_preference: 'NO_SHIPPING' }
})
});
},
(The fetch requests gets my card items.)
Following the docs: https://developer.paypal.com/docs/checkout/integration-features/standard-card-fields/#optimize-the-card-fields it's working nicely to pass the billing address which I already have. Only the phone Number does not get filled.
What is needed to fill the phone field with above example? Or even better is it possible to set it to not required?
The number length for National Numbers is a validation for the API; using the US example you needed the correct length of the phone number. For US Numbers it expects 1 ### ### ####
I am here to ask a question about mongo aggregate function to achieve this example.
Scenario
I have 3 Mongo Schema i.e House, family and educations which as :
House: {
_id: ObjectId,
state: Number,
houseNumber: Number
}
Family: {
_id: ObjectId,
houseId: ObjectId,//ref: house
name: String,
gender: String
}
Education: {
_id: ObjectId,
familyId: ObjectId,//ref: Family
level: String, //might be one of ["primary","secondary","higher_secondary"]
}
Expected Output:
{
state1: {
primary: {
male: 3,
female: 4
},
secondary: {
male: 4,
female: 8
}
},
state2: {
primary: {
male: 5,
female: 4
},
secondary: {
male: 4,
female: 6
}
}
}
I want to group all the education level by gender and then ward.
What I did:
I am newbie in mongo world and recently shifted from sql to no-sql. I had done this:
let edu = await Education.find({level: "primary"}).populate({
path: "family",
match: {gender: "male"},
select: "house",
populate: {
path: "house",
match: {state: 1},
select: "_id"
}
});
let count = (await edu.filter(each => !isEmpty(each.family) && !isEmpty(each.family.house)).length) || 0;
By doing this I get count of male member who has studied primary from state 1. but I cannot afford to call this function one by one for each data.
As requestd the sample data are:
house = [
{
_id: AA1,
state: 1,
houseNumber: 101
},
{
_id: AA2,
state: 1,
houseNumber: 102
},
{
_id: AA3,
state: 2,
houseNumber: 201
}
];
family = [
{
_id: BB1,
houseId: AA1, //ref: house
name: "John",
gender: "male"
},
{
_id: BB2,
houseId: AA1, //ref: house
name: "Solena",
gender: "female"
},
{
_id: BB3,
houseId: AA2, //ref: house
name: "Efrain",
gender: "male"
},
{
_id: BB4,
houseId: AA3, //ref: house
name: "Naruto",
gender: "male"
}
];
education = [
{
_id: CC1,
familyId: AA1, //ref: Family
level: "primary"
},
{
_id: CC2,
familyId: AA2, //ref: Family
level: "secondary"
},
{
_id: CC3,
familyId: AA3, //ref: Family
level: "primary"
},
{
_id: CC4,
familyId: AA4, //ref: Family
level: "secondary"
}
];
P.S expected output is not relevant output to the sample data. And ObjectId has been replaced with some unique reference.
Any lead from here guyz?
You can use below aggregation query in 4.x version.
Query the family collection and join to education collection to get the level followed by join to house collection to get the state.
Once you have all the data group by state, level and gender to count all the matches followed by other groups for formatting result. Last stage to promote the aggregated result into its own document.
Last two groups formatting the results from previous stage into named key value document. First group to format the results into gender and count grouped by state. Second group to format the previously combined gender and count with education key.
Finally replace root stage to format the combined gender, count and education doc with state key.
Also added output after each stage for clarity.
db.family.aggregate(
[
{"$lookup":{
"from":"education",
"localField":"_id",
"foreignField":"familyId",
"as":"education"
}},
{"$unwind":"$education"},
{"$lookup":{
"from":"house",
"localField":"houseId",
"foreignField":"_id",
"as":"state"
}},
{"$unwind":"$state"},
{"$group":{
"_id":{
"state":"$state.state",
"education":"$education.level",
"gender":"$gender"
},
"count":{"$sum":1}
}},//{"_id":{"state" :1,"education" :"secondary","gender":"female"},"count":1}
{"$group":{
"_id":{"state":"$_id.state","education":"$_id.education"},
"gandc":{"$mergeObjects":{"$arrayToObject":[[["$_id.gender","$count"]]]}}
}},//{"_id":{"state":1,"education":"primary"},"gandc":{"male":2}}
{"$group":{
"_id":"$_id.state",
"egandc":{"$mergeObjects":{"$arrayToObject":[[["$_id.education","$gandc"]]]}}
}},//{"_id":1,"egandc":{"primary":{"male":2},"secondary":{"female":1}}}
{"$replaceRoot":{"newRoot":{"$arrayToObject":[[[{"$toString":"$_id"},"$egandc"]]]}}} ])
])
//{"1":{"primary":{"male" : 2 },"secondary":{"female":1}}}
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.