Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdonisJS 6 #17

Open
MichaelBelgium opened this issue Jan 25, 2024 · 5 comments
Open

AdonisJS 6 #17

MichaelBelgium opened this issue Jan 25, 2024 · 5 comments

Comments

@MichaelBelgium
Copy link

MichaelBelgium commented Jan 25, 2024

Adonis V6 got released on the 24th of january, it'd be great if you make this package compatible :)

There is a package migration guide

@lviardcretat
Copy link

Is the repository is dead? No sign of any activity...

@MichaelBelgium
Copy link
Author

@IceCrew-Source Looks like it...

It's been a month now, I might have to make a fork and make it compatible myself

Unless there is another stripe package for adonis v6?

@ammezie
Copy link
Contributor

ammezie commented Feb 24, 2024

I've been quite busy lately. This is currently been worked on. Expect a new version to be tagged in the coming week.

@CodingDive
Copy link

Hey @ammezie, have you already gotten around to work on this? 🙌

@MichaelBelgium
Copy link
Author

@CodingDive I found out you don't really need this package, you can achieve the same thing by installing the official stripe package and making a provider and service in your adonisjs app

stripe_provider.ts

import env from '#start/env';
import type { ApplicationService } from '@adonisjs/core/types'
import Stripe from 'stripe';

declare module '@adonisjs/core/types' {
    export interface ContainerBindings {
      'stripe.manager': Stripe
    }
}

export default class StripeProvider {
    constructor(protected app: ApplicationService) {}

    /**
     * Register bindings to the container
     */
    register() {
      this.app.container.singleton('stripe.manager', () => {
        return new Stripe(env.get('STRIPE_SECRET_KEY')!, {
            apiVersion: '2024-04-10',
        });
      });
    }
}

stripe_service.ts

import app from '@adonisjs/core/services/app';

const stripe = await app.container.make('stripe.manager');
export { stripe as default }

And then you can use it like normally, for example

import stripe from '#services/stripe_service';

//...

async foo()
{
    const activeSubs = await stripe.subscriptions.list({
        status: 'active'
    });

    return activeSubs;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants