Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Authentication

Access to the resource requires a valid access token.


On this page

Table of Contents

Bulk Shipment payment

At the time of offer selection, the other offers (not selected) are deleted. Application allows for bulk shipment payment only in the case where all data is entered correctly (given shipment ID's belong to the organization, offer ID's are properly assigned to shipments and weren't previously paid for etc.)

Info

Attention! Asynchronous processing

Because the process of buying a shipment is asynchronous the server will return a response without changes related to the buy itself (status change, tracking number assignment) because that data will be available only after some time


Code Block
languagejson
POST /v1/organizations/:organization_id/shipments/bulk_buy

Parameters

Parameter

Type

Description

Validation

shipments

Array[Hash]

Bulk Buy Shipments

...

Allows for bulk purchase of shipments.


Table may consist of a maximum of

...

100 elements.

shipments have the following attributes:

Parameter

Type

Description

id

String

...

Unique shipment ID that allows the

...

return

...

of shipment validation errors related to the specific shipment.

shipment_id

Integer

Shipment

...

ID

offer_id

Integer

Offer

...

Request example

...

ID

Example request

Code Block
languagejson
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/shipments/bulk_buy -H '

...

Authorization: Bearer token' -H '

...

Content-

...

Type: application/json' -d '{
  "shipments":[
    {"id": 1, "shipment_id": 235, "offer_id": 284},
    {"id": 2, "shipment_id": 236, "offer_id": 285}
  ]
}'

...

In response, the server returns the status of 204.

After choosing the offer, other not selected offers are removed. The application may be used to make bulk payments for shipments only when all the data are entered correctly (shipment numbers belong to the organization, ID of offers are correctly assigned to the shipment, they are already paid, etc.)

Info
titleCaution! Asynchronous operation.

Since the purchase of shipment is asynchronous, the server will return details of the shipment, not taking into account the changes caused by the purchase (status change, assigning transport number), as this information will only be available after a certain time.

...

Response

Code Block
languagejson
HTTP/1.1 204 No Content
Content-Type: application/json

Warning

Error information

The server can return the following errors during bulk shipment payment:

  • resource_not_found - When shipment doesn't exist or user has no access to it

  • offer_unavailable - Offer is in a different status than available  or selected

  • transaction_failed - If the payment processing was not successful


Asynchronous Shipment payment

To retrieve information about the successful purchase of the shipment,

...

in the organization settings

...

define a url

...

for

...

sending shipment_confirmed  events. This

...

will result in ShipX sending the following information to the

...

url.

Code Block
languagejson
POST http://{{

...

webhook client return address}}
Content-Type: application/json

...


{
	"event_ts":"2015-12-08 19:42:42 +0100",
	"event":"shipment_confirmed",
	"organization_id":1,
	"payload": {
		"shipment_id":1234567890,
		"tracking_number":"681549342531876019900138"
	}
}

...

List of errors that may occur when paying for shipment:

...