stripe.createToken('account') react-native - stripe-payments

i'm using stripe in my web application , now i have to use this method (stripe.createToken('account', { business_type: 'individual',) in my react-native applicaiton, i want to know if there is any alternative for this method in react-native , using stripe tips doesnt have this method . please help .
const accountResult = await stripe.createToken('account', {
business_type: 'individual',
individual : {
first_name: values.firstname,
last_name: values.lastname,
email:this.props.data.email,
phone:this.state.phoneNumber,
address: {
line1: values.address.split(",")[0],
city: values.city,
state: 'France',
postal_code: values.postalcode.toString(),
},
dob:{
day:Day,
month:Month,
year:Year,
},
verification:{
additional_document:{
front:fileDatathree.id
},
document:{
front:fileData.id,
back:fileDatatwo.id
}
}
},
tos_shown_and_accepted: true,
});
thanks :

Related

How can I set up a test, Stripe connect account on the backend and skip onboarding?

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",
},
},
},
});

How to send Email with FileAttachment from local disk

I am using node-ews for sending Email through MicroSoft Exchange using my corporate credendials.
But I cannot figure out how to attach .xlsx files to an email from local disk storage. It seems that there is no simple Path tag.
This is what i have
const ewsArgs = {
attributes: {
MessageDisposition: 'SendAndSaveCopy',
},
SavedItemFolderId: {
DistinguishedFolderId: {
attributes: {
Id: 'sentitems',
},
},
},
Items: {
Message: {
ItemClass: 'IPM.Note',
Subject: 'Subject',
Body: {
attributes: {
BodyType: 'Text',
},
$value: 'Bodytext',
},
ToRecipients: {
Mailbox: {
EmailAddress: 'email#email.ru',
},
},
IsRead: 'false',
Attachments: {
FileAttachment: [{
Name: 'filename.xlsx',
IsInline: false,
ContentType: 'text/xlsx',
ContentLocation: 'filename.xlsx',
}]
}
},
},
};
What am I doing wrong?
Check your contentLocation. You need to give the correct path of the file you want to attach. But you just provided the filename.
Content-Type: application/vnd.ms-excel

Not able to get authorization on 2checkout

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

Braintree accepting wrong value for account Number

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.

node.js odata-server mongodb unable to post related entity

I have been working on a node.js odata server based on this example: How to set up a nodejs OData endpoint with odata-server
I have everything working... I can read, update, insert, delete. But I am trying to associate a Journal with a Tasks and I am having problems.
I have tried several different ways outlined here: Operations (OData Version 2.0)
Here is my code:
/* global $data */
require('odata-server');
$data.Class.define("Task", $data.Entity, null, {
Id: { type: "id", key: true, computed: true, nullable: false },
Title: { type: "string", required: true, maxLength: 200 },
Journals: { type: "array", elementType: "Journal"
, inverseProperty: "Task" }
});
$data.Class.define("Journal", $data.Entity, null, {
Id: { type: "id", key: true, computed: true, nullable: false },
Entry: { type: "string" },
DateInserted: { type: "string" },
Task: { type: "object", elementType: "Task" , inverseProperty: "Journals" }
});
$data.EntityContext.extend("obb", {
Tasks: { type: $data.EntitySet, elementType: Task },
Journals: { type: $data.EntitySet, elementType: Journal }
});
$data.createODataServer(obb, '/api-v0.1', 2046, 'localhost');
Question:
Is this feature even available from odata-server what would the post look like to link a Journal to a Task?
I am using fiddler2 and composing a POST I have tried these urls:
//localhost:2046/api-v0.1/Tasks('the-id-of-a-task')/Journals
//localhost:2046/api-v0.1/Tasks('the-id-of-a-task')/Journals/$link
post body's I have tried:
{"Entry":"This is a test"}
{"url":"http://localhost:2046/api-v0.1/Journals('id-of-a-journal-in-the-db')"}
I have even tried to build out and post a Task with journals together and that didn't work.
Any help would be greatly appreciated. Thanks.

Resources