Stripe Card Token no longer works.
Hello Jon,
Please check your code carefully.
Open browser console when test your project, there are errors.
Also check mapping in service StripePayment_CardTokenService
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hello Jon,
Please check your code carefully.
Open browser console when test your project, there are errors.
Also check mapping in service StripePayment_CardTokenService
Hello Benoit,
You have format 4242 4242 4242 4242, should be like 4242424242424242
Also please check mapping https://api.appery.io/rest/1/proxy/tu...
You have NaN in amount
Alena,
What code? Without writing any code, if you just create a new app, add the Stripe plugin, add the test key, and test the "StripePayment_CardTokenService" in the service view, it returns an error. There is no code...
Then, if you go to The Stripe dashboard, look at the log, and you will see that the request doesn't contain a JSON object like it used to. It looks all messed up like in my first post.
Mapping has nothing to do with it, as you can test the "StripePayment_CardTokenService" service without creating any mapping. It's been three days, and now we won't hear back from appery again until tomorrow since responses are only made once a day on this topic, delaying resolution yet further, when your plugin no longer works.
Even if you create a new app, and test your plugin straight out of the box, I will post snapshots in a minute...
Hello Alena,
The amount is not needed to get the Token number. In test, we need only the card number and even with 4242424242424242 it does not work.
As Jon is saying, the issue is coming from somewhere else. I have tried to use your new procedure for Stripe API and I have changed the proxy to match with the new recommandations. Nothing is working.
Thanks for your quick support,
Best regards,
Benoit
The issue is clear: Stripe's token api (https://api.stripe.com/v1/tokens) is interpreting the open brackets "[" and close brackets "]" in card[number], card[exp_month], card[exp_year], and card[cvc] as "%5B" and "%5D" respectively. Previously (3 weeks ago) it knew that this meant a JSON object named "card" with objects called number, exp_month, exp_year, and cvc (as shown in the original post).
Do you know how to solve it ? This is what I have noticed from stripe logs.
I've also tried to figure this out using the Appery server code. Here's what I've created (which I thought should work fine):
pre
var card = {
"number":"4242424242424242",
"exp_month":04,
"exp_year":2017,
"cvc":"123"
}
var secretKey = "sk_test_XXXXXXXXXXXXXXXXXXXXX";
var url = "https://api.stripe.com/v1/tokens";
var postData = {
"parameters": {
"card":card
},
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer " + secretKey
}
};
console.log(url);
var XHRResponse = XHR2.send("POST", url, postData);
response.success((XHRResponse.body), "json");
/pre
But it's returning this error:
Script createCardToken: Error: Failed to create URI: https://api.stripe.com/v1/tokens?card={ 'number' : '4242424242424242' , 'exp_month' : 4 , 'exp_year' : 2017 , 'cvc' : '123'} ( @ 38 : 18 ) - throw e
Stripe is saying we should NOT be using the bracket notation in our rest call. So instead of card[number], card[exp_month], card[exp_year], and card[cvc]. They're suggesting to use a hash instead.
This issue is extremely problematic. Without a Stripe token plugin, apps from Appery cannot process stripe payment (unless they already have the customer number). Otherwise, what other methods are there to reach the Stripe's api?
XHR2 method doesn't work either (as indicated above)...
is there a way to use Stripe.js with appery? Maybe using Stripe.js as a library in the server code...?