Question About Sapphire API
Is Sapphire plugin api can be used only for callback? for example. I want to make API for callback payment gateway that my bot will receive and confirm the payment from the user that has been successfully pay the product that i sell, and i send the the product to the DM
18 Replies
Developers on Discord: Enjoy Premium App Subscriptions and more!
Today, we’re announcing the ability for eligible US, EU, and UK-based app developers to monetize their Discord Apps natively on the platform with Premium App Subscriptions.
Just use discord native
It's under your discord developer portal -> your application -> monetisation

well, it's different
i have my own store with my local payment gateway
different indeed but also much better if you ask me
and the payment gateway is sending callback if the payment has been paid
what you're asking is
What I mean is this, I want to integrate my discord bot with the payment gateway that I use. The payment gateway will send a callback to my bot API if the transaction is successful. My question is, can Sapphire API be used for Callback API like that?
yes
it just uses node:http, the exact same thing that express, fastify, koa, etc use. Ergo, it can be used for it.
I see, then another question how do I use Middleware in the Sapphire API? I read the documentation and found Middleware, is it the same as Routes? create a middleware folder
yes
is there any exmaple to use the middleware?
the ones in the repo itself only really. No one has ever asked to implement their own middleware before so I have no idea if anyone has.
can you provide me the link?
GitHub
GitHub - sapphiredev/plugins: Plugins for the Sapphire Framework
Plugins for the Sapphire Framework. Contribute to sapphiredev/plugins development by creating an account on GitHub.
i tried to find it, but coulnd't find it
ah, okay thanks
thank you so much
what file name do i need to use? like for routes is hello.get.ts, for middleware?
it works the same as all other pieces in sapphire. Routes are the only exception to the norm.