Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request failed with status code 500 #27

Open
fibo opened this issue Oct 8, 2023 · 0 comments
Open

Request failed with status code 500 #27

fibo opened this issue Oct 8, 2023 · 0 comments

Comments

@fibo
Copy link

fibo commented Oct 8, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant