Where do I add the card and cvv number for usd payments only


#1

const express = require(“express”);

const { Paynow } = require(“paynow”);

// Create instance of Paynow class

let paynow = new Paynow(process.env.PAYNOW_ID, process.env.PAYNOW_KEY);

const router = express.Router();

router.post("/payment", async (req, res) => {

  try {

    let { amount, cardNumber, cvc, expiry } = req.body;

    // Set return and result urls

    paynow.resultUrl = “http://example.com/gateways/paynow/update”;

    paynow.returnUrl =

      “http://example.com/return?gateway=paynow&merchantReference=1234”;

    // Create a new payment

    let payment = paynow.createPayment(“Orderhut Payment”);

    // Add items to the payment list passing in the name of the item and it’s price

    payment.add(“Order”, amount);

    // Send off the payment to Paynow

    paynow.send(payment).then((response) => {

      // Check if request was successful

      if (response.success) {

        // Get the link to redirect the user to, then use it as you see fit

        let link = response.redirectUrl;

        // Save poll url, maybe (recommended)?

        let pollUrl = response.pollUrl;

        return res.status(200).json({

          message: “Payment successful”,

          success: true,

        });

      }

      return res.json({

        message: “Payment failed”,

        success: false,

      });

    });

  } catch (error) {

    return res.status(500).json({ message: “Payment failed”, error: error });

  }

});

module.exports = router;


#2

Good day, please note that you do not need to get the card details when a payment is being made. The user should be redirected to Paynow where they will enter those details.

You can configure which currency/cards to accept on your integration settings page on Paynow.