Payment Provider
To add a new payment provider head over to
src/services/payment/providers
create a new provider with the name [provider].service.ts
Inside the file add the following code:
import { NextApiRequest } from "next";
import { PaymentInterface } from "@github20k/services/payment/payment.interface";
import { AbstractServicesService } from "@github20k/services/abstract.services.service";
import { object, string } from "yup";
export class ProviderService extends AbstractServicesService implements PaymentInterface
{
// required environment variables
validation = object({
PARAM: string().required(),
PARAM: string().required(),
});
providerName = "provider name";
async createACheckoutSession() {
// return url for the checkout page
}
async checkRequestAndReturnDetails(req: NextApiRequest) {
// process webhook url
}
}
Make sure to add the new provider name also in env.check.ts