A plugin to use Nova.Pay on Medusa.
Install the package via npm or yarn:
npm install @novamoney/nova-pay# oryarn add @novamoney/nova-pay
Add the following environment variables to your file:
NOVA_PAY_API_KEY=your_api_key_hereNOVA_PAY_CART_PAGE_ID=your_cart_page_uuid_hereNOVA_PAY_SUBDOMAIN=your_nova_pay_subdomain_hereNOVA_PAY_VERBOSE=true # Optional: enables sync logging
Enable the plugin in your file:
// medusa-config.tsmodule.exports = defineConfig({// ...plugins: [// ... other plugins{resolve: "@novamoney/nova-pay",options: {apiKey: process.env.NOVA_PAY_API_KEY,subdomain: process.env.NOVA_PAY_SUBDOMAIN},},],// ...modules: [// ... other modules{resolve: "@medusajs/medusa/payment",options: {providers: [{resolve: "@novamoney/nova-pay/providers/payment",id: "nova-pay",options: {apiKey: process.env.NOVA_PAY_API_KEY,cartPageId: process.env.NOVA_PAY_CART_PAGE_ID,subdomain: process.env.NOVA_PAY_SUBDOMAIN}},]}}]});
When you initiate a payment using one of the Nova.Pay providers, the response will include a in the object of the payment session. You must redirect the customer to this URL to complete the payment.
const handlePayment = async (paymentSession) => {if (paymentSession.data.link) {// Redirect to Nova.Pay checkoutwindow.location.href = paymentSession.data.link;}};
Licensed under the MIT License.