Your browser does not support Java Script or javascript is disabled. Please ensure that your browser supports it for full compatibility with our services.

Accept Order

Accept Order

After creating an order the client can either accept or cancel it. When the order has been accepted (payment information provided), the booking process begins. This is an asynchronous process and you will not receive actual booking status in the response. You will receive acknowledgement that the booking request was received. There are two options for monitoring a booking. You can either provide a callback URL so that when the order is processed the request will be sent to this URL  or you poll for a status with an additional API call using this functionality: "Fetch Order Data".

Customer accepts order.

Orders
URI
/orders/S2AO000001/accept/
Method PUT
Authorization
required

Parameters

Name
Required
Type
Description
order.id
optional string Id of the order which is going to be accepted.
order.payment
required payment object

Payment information.

order.payment.type
required string - 'credit_card', 'stored card' or 'credit'

Payment type: 'credit card' for credit card payment, 'stored card' for credit card already saved or 'credit' for a credit customer.

order.payment.credit_card
required/optional  credit card object

Credit card payment details. Required if payment type is 'credit card' or 'stored card'. For 'stored card' the be card ID should be obtained from this functionality: "Fetch Credit Card".

order.payment.credit_card.number
required string Credit card number. Required if payment type is 'credit card'.
order.payment.credit_card.cvv
required string Credit card verification number. Required if payment type is 'credit card'.
order.payment.credit_card.holder_name
required string Credit card holder's name. Required if payment type is 'credit card'.
order.payment.credit_card.expire
required string - date in format MM/YY

Credit card expiry date in MM/YY, MM - month, YY format - two last digits of year. Required if payment type is 'credit card'.

order.options.digital_signature
optional .png or .jpg file in BASE64 code

Encoded image of digital signature, used during generation of documents.

order.payment.credit_card.save
optional boolean true/false

If true credit card will be saved in s2a system. Optional if payment type is 'credit card'.

options.send_documents
optional boolean true/false

If true system sends email notifications to recipient and order creator with tracking number and documents.

options.account_number
optional string

DHL Account Number

callback
optional URL

Callback URL to which request will be sent when order is processed.

 

Payment types
credit_card

Customer pays by giving credit card details.

stored_card

Customer pays by using card already saved.

credit
Customer has credit account.

Credit card payment

{
    "request": {
        "order": {
            "payment": {
                "type""credit_card",
                "credit_card": {
                    "number""4444333322221111",
                    "cvv""111",
                    "holder_name""Foo Bar",
                    "expire""11/17"
                }
            }
        },
        "options": {
            "send_documents""true",
            "save""true"
        },
        "callback""https://s2asandbox.com/v1.0/:8888/"
    }
}

Stored card payment

{
    "request": {
        "order": {
            "id""S2AO000001",
            "payment": {
                "type""stored_card",
                "credit_card": "20140410211259034710"
            }
        },
        "options": {
            "send_documents""true"
        },
        "callback""https://s2asandbox.com/v1.0/:8888/"
    }
}



Credit account payment

A credit account is a special account type which allows shipping now and payment later. This account can be created by contacting Ship2Anywhere support.

{
    "request": {
        "order": {
            "id""S2AO000001",
            "payment": {
                "type""credit"
            }
        },
        "options": {
            "send_documents""false"
        },
        "callback""https://s2asandbox.com/v1.0/:8888/"
    }
}

Callback parameter

Callback is a URL which will be called when an order is processed.

Callback endpoint specification

Callback
Method POST

Callback data

{
    "code"200,
    "message""OK",
    "result": {
        "order": {
            "id""S2AO000001",
            "status""processed",
            "shipments": [
                {
                    "id""S2AS000001",
                    "tracking_number""ABC123"
                }
            ]
        }
    }
}

 Note Callback data has the same format as the response message, this allows for error reporting.


Response

 

{
    "message": "OK",
    "code": 201,
    "result": {
        "order": {
            "status": "ACC",
            "shipments": [
                {
                    "status": "NEW",
                    "delivery": {
                        "phone": "+123123123",
                        "first_name": "foo",
                        "last_name": "Bar",
                        "postcode": "20001",
                        "city": "Washington",
                        "country": "US",
                        "company": "private individual",
                        "address_lines": [
                            "address line 1",
                            "address line 2",
                            "address line 3"
                        ],
                        "email": "andrzej.papa@gmail.com"
                    },
                    "tracking_number": "N/A",
                    "collection_type": "pickup",
                    "description": "Here some optional comments about s",
                    "service": {
                        "price": {
                            "currency": "AUD",
                            "amount": 219.51,
                            "total": 223.07,
                            "insurance": 3.56,
                            "gst": 0
                        },
                        "code": "1002",
                        "name": "DHL Asia"
                    },
                    "customs_information": {
                        "tax_status": "Company",
                        "reason": "Purchase",
                        "description": "",
                        "items": [
                            {
                                "currency": "AUD",
                                "madein": "US",
                                "description": "shoes",
                                "value": 20,
                                "quantity": 1
                            }
                        ]
                    },
                    "packages": [
                        {
                            "width": 20,
                            "length": 10,
                            "unit_weight": "CM",
                            "weight": 3,
                            "height": 30
                        }
                    ],
                    "id": "S2AS004412",
                    "collection": {
                        "phone": "+61123123123",
                        "first_name": "Fred",
                        "last_name": "Flintstone",
                        "postcode": "3000",
                        "city": "Melbourne",
                        "country": "AU",
                        "company": "private individual",
                        "address_lines": [
                            "address line 1",
                            "address line 2",
                            "address line 3"
                        ],
                        "pickup": {
                            "date": "2014-05-03T00:00:00",
                            "time_latest": "14:00",
                            "time_earliest": "09:00"
                        },
                        "email": "andrzej.papa@gmail.com"
                    }
                }
            ],
            "price": {
                "currency": "AUD",
                "amount": "219.51",
                "total": "223.07",
                "insurance": "3.56",
                "gst": "0.00"
            },
            "id": "S2AO001737"
        }
    }
}