I am trying to create a Stripe toke, but without elements.
This is my code:
stripe.createToken('person', {
card: '4242424242424242'
}, function(err, token) {
console.log(token)
// asynchronously called
});
The error in the console is:
Unrecognized token creation parameter parameter: card is not a recognized parameter. This may cause issues with your integration in the future.
The response error is:
You must supply either a card, customer, PII data, bank account, or account legal entity to create a token. If you're making this request with a library, be sure to pass all of the required parameters for creating a token. If you're making this request manually, be sure your POST parameters begin with the token type. For...
I can't find in the docs, which params, I must add.
You cannot create a token using a raw credit card in the current version of Stripe's APIs. You must use an element. While this is not explicitly stated in the createToken documentation, there is a notice in the createSource docs:
You cannot pass raw card information to stripe.createSource(sourceData). Instead, you must gather card information in an Element and use stripe.createSource(element, sourceData). You can also pass an existing card token to convert it into a Source object.
If you absolutely do not want to create an element, you could use the deprecated Stripe.card.createToken v2 API, but this is not recommended.
Related
I am trying to capture a payment intent I have previously created. The payment intent has been set up and confirmed and I am now looking to complete the payment intent with the final amount and transfer the money to a stripe connect user.
const intent = await stripe.paymentIntents.capture({
id: paymentIntentId,
amount_to_capture: finalAmount,
transfer_data:{destination: connectedAccountId,},
});
The above code snippet is what I have so far, I know this is the correct method but I'm getting the following error:
Error: Stripe: Argument "intent" must be a string, but got: [object Object]
It must be to do with how I'm assigning the connect account id. reading the stripe api docs I need to pass the connect account id to the destination field of transfer data.
How should I be passing that in to the nested destination field. My syntax must be wrong.
Here is the stripe documentation for capturing a payment:
Stripe Capture Payment API Documentation
Any help is greatly appreciated.
Are you sure paymentIntentId is in fact an id as a string? From the error, it sounds like this might be a payment intent object and you'd need to use something like paymentIntent.id instead. (paymentIntentId.id as a quick correction, but you should rename the variable to represent its contents).
Double check the value of paymentIntentId -- it's probably different than you expect.
Update: This is due to a misreading of the syntax. The payment intent id is the first argument as a string, with the options in an object as a second argument. So then this is what you need:
const intent = await stripe.paymentIntents.capture(
paymentIntentId,
{
amount_to_capture: finalAmount,
transfer_data: { destination: connectedAccountId, },
}
);
I am doing a query onto a class where I have a pointer to a User.
I do query.include('byUser') and when I log out the query result it's shown but when I try to get a specific attribute like email. It doesnt exist.
I also first thought it was odd that I have to get the User details by doing:
const userDetails = query.get("byUser").attributes;
Do I have to do .attributes? And also why isn't the email showing up. Everything else seems to show up in the attributes section.
Thanks
Please note that in parse, you can not query the email field of other users. you can see the email field only if you are the signed in user. This is a security mechanism.
A. If you want to get the email field for a user object, you can do two things:
Pass the user session token to the query.
new Parse.Query(Parse.User).get(<userId>,{sessionToken:<userSessionToken>});
Use master key. (Note: You have to set the master key before.)
new Parse.Query(Parse.User).find({useMasterKey:true});
B. Your include method is correct and it it will fetch the byUser object. You do not need to use .attributes.
UPDATE:
You can also set a publicEmail field in your User class which will not be filtered out by parse-server. to automate this, you can write a cloud code.
Cloud Code Example (on parse-server V 3.0.0 and above):
PLEASE NOTE THAT YOU CAN NOT USE ASYNC FUNCTIONS FOR PARSE-SERVER < V 3.0.0
Parse.Cloud.beforeSave(Parse.User, async req=>{
if (!req.original && !req.master && req.object.get('email')){
req.object.set('publicEmail',req.object.get('email'));
}
})
Now, if new user sign up, this cloud code will automatically adds a new field to the user object publicEmail which is not filtered by parse-server.
Firebase says that in the customize email action handler that they will implement getParameterByName. What does that exactly mean?
firebaser here
I'll assume you're referring to this page of the Firebase Authentication documentation, which contains the following code snippet:
// TODO: Implement getParameterByName()
// Get the action to complete.
var mode = getParameterByName('mode');
// Get the one-time code from the query parameter.
var actionCode = getParameterByName('oobCode'};
// (Optional) Get the API key from the query parameter.
var apiKey = getParameterByName('apiKey'};
Note that I only copied enough of the code to answer your question. Refer to the link for full code.
The custom email handler is an HTML page that is invoked by Firebase when there is an action that you may want to respond to. The Firebase back-end informs your page of the action and its data, by passing these as URL parameters when invoking your page.
So say you have your custom handler in a page called my_email_handler.html, it may invoked your page as: my_email_handler.html?mode=resetPassword&oobCode=123456&apiKey=AZdfshjsdfhj
The/your page then parses these URL parameters and takes the appropriate (custom) action.
The comment is a TODO for you as the application developer, you will need to implement a getParameterByName() method that retrieves the value from a URL parameter with the given name. If you do a search for getParameterByName you'll find quite some implementations of such a function.
I am trying to use the Yodlee REST API to access our Private Zone and add a new user. I am using the register3 api which I'm calling at
https://sdkint11.yodlee.com/yodsoap/srest/private-XXX/v1.0/jsonsdk/UserRegistration/register3
The dummy user credentials are as follows:
{ cobSessionToken: '10072014_0:58f1876ccc25848a712fade98d9d31c067cb5b4d322094845b4f8359ee59dc2ba01f1e94cfc9d5bd116d32ff6333f84fd848817b9b20cd9b1e85d50774a0ea32',
userCredentials:
{ loginName: 'AAAAAA',
password: 'BBBBBB',
objectInstanceType: 'com.yodlee.ext.login.PasswordCredentials' },
userProfile: { emailAddress: 'ABC#DEF.co.uk' } }
I've changed the credentials a bit for privacy, and for now I'm only using the 5 mandatory arguments required to establish a new user.
The (not very helpful) error I'm getting is
{"errorOccurred":"true","exceptionType":"Exception
Occurred","referenceCode":"_e37c33ab-b59c-4fbc-ab6a-1a2b83f5784f"}
which doesn't help debugging much.
Anyone any ideas?
You are passing the parameters in form of objects which will not be accepted by Yodlee. You will have to strictly follow the way it's represented in the document.
So your request parameter should look like for example -
cobSessionToken: '10072014_0:58f1876ccc220950774a0ea32',
userCredentials.loginName:'AAAAAA', userCredentials.password:'BBBBBB'
Please try out the suggested changes.
I'm trying to get list of issues from Bit Bucket via REST API with OAuth.js (http://oauth.googlecode.com/svn/code/javascript/). I'm signing every request with
OAuth.completeRequest(message, accessor);
where message is
message: {
action: "https://api.bitbucket.org/1.0/repositories/owner/reponame/issues",
method: "GET",
parameters: p;
};
When p contains parameters with different names, everything is OK:
p = [['status','open'],['priority','high']]
but when p contains parameters with the same name
p = [['status','open'],['status','resolved']]
, server responds 401 UNAUTHORIZED.
Bitbucket API support mutliple instances of the same parameter:
You can query for multiple instances of the same parameter. The system treats multiple instances of the same parameter as an OR for the overall filter query. For example, the following filter looks for open and resolved bugs with the word for in the title:
status=open&kind=!bug&status=resolved&title=~for
I think that problem somewhere in signing methods of the OAuth.js library, but can't find it.
It was a bug on bitbucket side:
https://bitbucket.org/site/master/issue/7009/you-cannot-use-multiple-identical-query