Hi guys,
I’m upgrading an app to Meteor 1.2 and one of the things we do is to allow connection of the users using OAuth from Stripe using https://github.com/chadokruse/meteor-accounts-stripe-connect.git installed in packages/
I’m now trying with this one but no luck so far:
https://atmospherejs.com/dancaws/accounts-stripe
Any of you is able to use Stripe’s OAuth in a Meteor 1.2 app?
What sort of issue are you having?
Hi @mstanton ,
I’ve edited the package.js
so it has the format expected by Meteor 1.2
Package.describe({
summary: "Login service for Stripe accounts using Stripe Connect",
name: "chadkruser:meteor-accounts-stripe-connect",
version: "0.0.6",
git: "https://github.com/chadokruse/meteor-accounts-stripe-connect.git",
});
Package.onUse(function(api) {
api.versionsFrom('METEOR@1.0', '1.2');
api.use('accounts-base', ['client', 'server']);
api.imply('accounts-base', ['client', 'server']);
api.use('accounts-oauth', ['client', 'server']);
api.use('oauth', ['client', 'server']);
api.use('oauth2', ['client', 'server']);
api.use('http', ['server']);
api.use('underscore', 'server');
api.use('templating', 'client');
api.use('random', 'client');
api.use('service-configuration', ['client', 'server']);
api.addFiles("lib/accounts_stripe.js");
api.addFiles('lib/stripe_client.js', 'client');
api.addFiles('lib/stripe_server.js', 'server');
});
but when I’m trying to initialize as before I’m getting
Cannot read property 'requestCredential' of undefined
Here is the initialize method I’ve used in previous versions:
Meteor.startup( function () {
Stripe.setPublishableKey('xxxxxxxx');
initializeClient();
});
function initializeClient () {
Meteor.linkWithStripe = function (options, callback) {
if (!Meteor.userId()) {
throw new Meteor.Error(402, 'Please login to an existing account before link.');
}
if(!Package['chadkruser:meteor-accounts-stripe-connect']) {
throw new Meteor.Error(403, 'Please include stripe oAuth package')
}
if (!callback && typeof options === 'function') {
callback = options;
options = null;
}
var credentialRequestCompleteCallback = Accounts.oauth.linkCredentialRequestCompleteHandler(callback);
Package['chadkruser:meteor-accounts-stripe-connect'].StripeOauth.requestCredential(options, credentialRequestCompleteCallback);
};
$.fn.form.settings.rules.creditcard = function (value) {
return Stripe.card.validateCardNumber();
};
};
shock
September 28, 2015, 3:09pm
4
So this is undefined.
Package['chadkruser:meteor-accounts-stripe-connect'].StripeOauth
yes, Package['chadkruser:meteor-accounts-stripe-connect']
actually shows an empty object. I didn’t expect that. Means that package is not adequately added?
I’ve cloned it into packages/
then did `meteor add chadkruser:meteor-accounts-stripe-connect``
Did I miss something?
Did you mean that?
api.versionsFrom
takes a (single) string or an array of strings. I would have maybe expected:
api.versionsFrom(['METEOR@1.0', '1.2']);
Nice catch!
I’ve used api.versionsFrom('1.2')
now but this
Package['chadkruser:meteor-accounts-stripe-connect']
is still an empty object and I see the same issues
I’ve found out that the Stripe object that is setup by meteor-accounts-stripe-connect
is being replaced by the one set by mrgalaxy:stripe
I’m trying to figure out how to make them play well together =/
ffxsam
September 29, 2015, 6:48pm
9
I’ve heard more than one person recommend using copleykj:stripe-sync
instead of mrgalaxy:stripe
. Try that, maybe.
It’s nice that it seems to have the complete API for once you have it authorized, but it doesn’t have the OAuth.
I’ve been doing operations with mrgalaxy:stripe
without issues but now in this upgrade the method Meteor.loginWithStripe
fails because Stripe.requestCredential
is undefined =/
Following up on this matter…
I’ve patched a fork and opened a PR:
Thanks @krishamoud for reviewing and merging.
If I understood right that repo is related to:
https://atmospherejs.com/mrt/accounts-stripe
1 Like
Sorry that it took so long. I’ve been pretty busy recently. If you need something else fixed in that package just ping me on here.
1 Like