Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Info |
---|
Warning! Resource available only in the following countries: PL, IT |
On this page
Table of Contents |
---|
minLevel | 2 |
---|
Paying for Shipment
At the time of offer selection, the other offers (not selected) are deleted.
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 assignement) because that data will be available only after some time. |
Code Block | ||
---|---|---|
| ||
POST /v1/shipments/:id/buy |
Parameters
Parameter | Type | Description | Validation | Availability |
---|---|---|---|---|
| Integer | Offer ID available for the shipment being paid. | The attribute is required.
| PL, IT |
Example request:
Code Block | ||
---|---|---|
| ||
curl -X POST https://api-shipx-pl.easypack24.net/v1/shipments/1/buy -H 'Authorization: Bearer token' -H 'Content-Type: application/json' -d '{
"offer_id": 1456
}' |
Response
Code Block | ||
---|---|---|
| ||
HTTP/1.1 200 OK
Content-Type: application/json
{
"href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/shipments/1",
"id": "1",
"parcels": [
{
"id": "small package",
"template": "small",
"dimensions": {
"length": "80",
"width": "360",
"height": "640",
"unit": "mm"
},
"weight": {
"amount": "25",
"unit": "kg"
},
"tracking_number": null
}
],
"custom_attributes": {
"target_point": "KRA010",
"dropoff_point": null,
"sending_method": "parcel_locker",
"dispatch_order_id": 1
},
"sender": {
"id": "123",
"name": "Nazwa",
"company_name": "InPost S.A.",
"first_name": "Jan",
"last_name": "Nowak",
"email": "sender@email.com",
"phone": "888000000",
"address": {
"id": "123",
"street": "Malborska",
"building_number": "130",
"city": "Kraków",
"post_code": "30-624",
"country_code": "PL"
}
},
"receiver": {
"id": "123",
"name": "Nazwa",
"company_name": null,
"first_name": null,
"last_name": null,
"email": "sender@email.com",
"phone": "888000000",
"address": null
},
"created_at": "2015-09-06T19:21:00.000+02:00",
"cod_amount": {
"amount": 12.50,
"currency": "PLN"
},
"insurance": {
"amount": 25,
"currency": "PLN"
},
"reference": "Order No. 12345",
"is_return": false,
"tracking_number": null,
"external_customer_id": "8877xxx",
"offers": [
{
"id": 1456,
"carrier": {
"id": "inpost_locker",
"name": "InPost Paczkomaty",
"description": "InPost Paczkomaty - Przesyłki paczkomatowe."
},
"service": {
"id": "inpost_locker_standard",
"name": "Paczkomatowa Standardowa",
"description": "Przesyłka paczkomatowa standardowa."
},
"status": "selected",
"valid_to": null,
"rate": 2.02,
"currency": "PLN",
"unavailability_reasons": null
}
],
"selected_offer": {
"id": 1456,
"carrier": {
"id": "inpost_locker",
"name": "InPost Paczkomaty",
"description": "InPost Paczkomaty - Przesyłki paczkomatowe."
},
"service": {
"id": "inpost_locker_standard",
"name": "Paczkomatowa Standardowa",
"description": "Przesyłka paczkomatowa standardowa."
},
"status": "selected",
"valid_to": null,
"rate": 2.02,
"currency": "PLN",
"unavailability_reasons": null
},
"transactions": []
} |
Warning |
---|
Error Information Errors that may appear when paying for a shipment:
|
|
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 | ||
---|---|---|
| ||
POST https://{{configuration_url}}
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"
}
} |