Page tree
Skip to end of metadata
Go to start of metadata

Bulk payment for shipments

POST /v1/organizations/:organization_id/shipments/bulk_buy

Parameters

ParameterTypeDescriptionValidation
shipments

Array[Hash]

Bulk Buy Shipments Form

The table may consist of maximum 100 elements.

ParameterTypeDescription
idStringThe unique identifier of the shipment, which allows the user to return the validation error information assigned to a particular shipment.
shipment_idIntegerShipment identifier
offer_idIntegerOffer identifier
The table may consist of maximum 100 elements.

Request example

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.)

Caution! 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.

To obtain information about the successful purchase of the shipment, define in the organization settings the url address for sending information on shipment_confirmed. This makes ShipX application to send the following information to the provided address:

POST http://{{adres_podany_w_konfiguracji}}
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:

  • resource_not_found - may occur when a specific shipment does not exist or when the user has no access to it,
  • offer_unavailable - occurs when an attempt is made to pay for the offer with status other than available or selected,
  • transaction_failed - may occur when attempt to pay for shipment failed.
  • No labels