Create an order

An order is created when a payer wants to make a payment using Wagent. You can create an order by calling the following endpoint:

POST /orders

Request Body:

{
  "products": [
    {
      "name": "Macbook M1",
      "logo": "https://bing.com/1.jpg",
      "amount": 2000,
      "count": 5
    }
  ],
  "amount": 1000,
  "redirectUrl": "http://yourshop.com/some_unique_id_for_each_order"
}

Headers:

apiKey: YOUR_API_KEY

You should provide either amount or products. If you have a complete product list, use the products field, and the total amount will be calculated based on each product's count and price. If the product list is not available, you can simply enter the amount and specify the price in USD.

The redirectUrl is used to redirect the payer after the payment has been completed or if the payment is canceled.

Successful Response:

If everything goes well, the API will return the following response:

Status: 200

Response Body:

{
  "message": "Order has been created",
  "result": {
    "id": "66f233c4a1762f8f665e02e7",
    "url": "https://pay.wagent.app/66f233c4a1762f8f665e02e7"
  }
}

This response confirms that the order has been successfully created, providing the order ID and a URL for payment.

Now, you can redirect the payer to the response.result.url

Last updated