Skip to content

Readme is outdated #9

@asanducristian

Description

@asanducristian

update the readme with the current version of startPayment. Tried to create a PR but 403 so...

  const netopia = new Netopia({
    apiKey: process.env.NETOPIA_API_KEY,
    sandbox: true,
  });

  const requestData = {
    // Required fields:
    order: {
      amount: "100.00",                 // Payment amount
      currency: "RON",                  // Payment currency (RON, EUR, etc.)
      dateTime: "2024-06-10T12:00:00Z", // Order timestamp
      orderID: "ORDER-123456",          // Unique order identifier
      billing: {
        firstName: "John",              // Customer's first name
        lastName: "Doe",                // Customer's last name
        email: "john.doe@example.com",  // Customer's email address
        phone: "+40721234567",          // Customer's phone number
      }
    }
    products: [                         // array of products
        {                               // it works also by sending an array of empty json objects but don't know if it breaks anything else
            name: 'name',
            code: 'SKU',
            category: 'category',
            price: 1,
            vat: 19,
        },
    ],
  };

  try {
    netopia.setOrderData(requestData.order);
    netopia.setProductsData(requestData.order.products);
    const response = await netopia.startPayment();
    res.status(200).json(response);
  } catch (error) {
    res.status(500).json({ message: error.message });
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions