createSale

Method allows to create order with specific details (in account selected currency).
Make sure you have all your account information set (contact, invoice data, etc.) on the website before submitting your first order!

Usage URL: https://b2b.onesto-energy.pl/api/createSale.json?key=YOURAPIKEY

Query params

(put those in your URL, e.g. ?id=123)

  • lang

    string

    Language of result. ISO 2 Letter Language Codes ie

    Example: en, pl, cs

  • test

    boolean (1 = true, 0 = false)

    Enables a sandbox mode - no data will be written on the server.

POST data

(if any - change request to POST, put those in as form-data)

  • fkshipmenttype | required

    integer

    Shipment type internal identifier

  • fkpaymenttype | required

    integer

    Payment type internal identifier

  • doc_type | required

    string

    Which document should be assigned to sale. Available: "receipt" or "invoice"

  • shipment_diff_invoice

    boolean (1 = true, 0 = false)

    Points whether shipping address is different from client (invoice) address.
    If set to yes, you have to fill "shipping" data
    This field is mandatory if you are using a drop-shipping client

  • currency

    string

    Currency symbol. If omitted - account currency will be picked

    Example: Three letters format ie: PLN, EUR, USD.

  • is_assembling

    boolean (1 = true, 0 = false)

    Points whether order is going to be modified or more products added

  • pickup_point

    string

    Unique ID of selected pickup point. Required only if fkshipmenttype points at the pickup point delivery type.
    This field replaces 6 old separate fields for each pickup point delivery shipment type.
    - For Poczta Polska - it's PNI,
    - For DHL - it's SAP

  • notice

    string

    Order's notice

  • products | required

    object[]

    An array with requested products.

    • id | required

      integer

      Product internal ID

    • qty | required

      float

      Product quantity you want to order

  • shipping

    object

    Array with shipping address - required only if "shipment_diff_invoice" = true

    • receiver_name | required

      string

      Receiver's full name / company name

    • postal_code | required

      string

      Receiver's postal code

    • city | required

      string

      Receiver's city

    • street | required

      string

      Receiver's street

    • home_number

      string

      Receiver's building number

    • flat_number

      string

      Receiver's flat nummber

    • phone | required

      string

      Receiver's phone number

    • email | required

      string

      Receiver's email address

    • country | required

      string

      Receiver's country - ISO2 code

      Example: Two letters format ie: DE, PL, GB, US

  • own_label

    object

    Array with information about supplied own label. Required and processed only if you have selected a valid delivery method. Allows customer to send us their own delivery label for the package (as long as given provider is supported by us). Since 10th November 2022 it is possible to upload multiple files.
    To get a valid fkshipmenttype value for this option - please refer to either of those methods: getAvailableDeliveryOptions, getShipmentTypes.

    • mode | required

      string

      Allows us to identify which field should be use for file validation. Following values are allowed: pdf, url

    • provider

      string

      Delivery carrier for given label. Following values are allowed: dpd, dhl, inpost, pocztapolska, ups, orlen, emag, olzalogistic

    • items

      object[]

      Array with data for each given label

      • url

        string

        URL address which points to your PDF label file. Make sure that given endpoint returns the correct PDF file and has 'Content-Type' header equal to 'application/pdf'. Required if mode = url

      • data

        string

        Base64 string with valid PDF inside. Required if mode = pdf

      • tracking_no | required

        string

        Comma separated tracking numbers from given label. If only one label is passed then put here that one tracking number.

  • ids

    integer[]

    Array with created sales IDs

  • messages

    object

    Generic success or failure message.
    Click here for more information

    • success

      string[]

      List of success messages

    • danger

      string[]

      List of errors, blocks the operation

    • warning

      string[]

      List of warnings, does not block the operation

fkshipmenttype=34&
fkpaymenttype=5&
notice=This is my notice&
doc_type=invoice&
inpost_box_name=WAW226M&
is_assembling=0&
shipment_diff_invoice=1&
products[0][id]=45356&
products[0][qty]=1&
products[1][id]=47990&
products[1][qty]=1&
shipping[receiver_name]=First and Last Name or Company Name&
shipping[postal_code]=23-456&
shipping[city]=Warsaw&
shipping[street]=Niepodleglosci&
shipping[home_number]=123&
shipping[flat_number]=&
shipping[phone]=+48 999-888-777&
shipping[email]=some-email@provider.com&
shipping[country]=PL&
invoice[vat_id]=DE8975305023&
invoice[regon]=&
invoice[name]=First and Last Name or Company Name&
invoice[firstname]=Test&
invoice[lastname]=Client&
invoice[postal_code]=12-345&
invoice[city]=Testing City&
invoice[street]=Test street&
invoice[home_number]=12&
invoice[flat_number]=34a&
invoice[phone]=+48 123-456-789&
invoice[country]=DE
Example URL: https://b2b.onesto-energy.pl/api/createSale.json?key=YOURAPIKEY&lang=en

{
    "messages": {
        "danger": [
            "You have unpaid overdue debts"
        ]
    }
}
Example URL: https://b2b.onesto-energy.pl/api/createSale.xml?key=YOURAPIKEY&lang=en

<?xml version="1.0" encoding="utf-8"?>
<root>
	<messages>
		<danger>
			<item>You have unpaid overdue debts</item>
		</danger>
	</messages>
</root>