Skip to content

Request failed with status code 500 #27

@fibo

Description

@fibo

I am getting "Internal Server Error" when trying to create an order.

To reproduce it you can use this script

import { ApiClient } from "@utrustdev/utrust-ts-library";

async function test() {
  console.log(process.env.UTRUST_API_KEY);
  const { createOrder } = ApiClient(process.env.UTRUST_API_KEY, "sandbox");

  const order = {
    reference: "1234",
    amount: { total: "60.00", currency: "EUR" },
    return_urls: {
      callback_url: "https://www.example.com/callback",
      return_url: "https://www.example.com/thank-you",
    },
    line_items: [
      {
        sku: "basic",
        name: "subscription",
        price: "60.00",
        currency: "EUR",
        quantity: 1,
      },
    ],
  };
  const customer = {
    email: "[email protected]",
    country: "IT",
  };

  try {
    const { data } = await createOrder(order, customer);
    console.log(data);
  } catch (error) {
    console.log(error);
  }
}

test();

Any hint?

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