A number of major international destinations of packages now will only accept packages with electronic CN23 customs declaration. Normally, you’d do this by rocking up to the Post Office with your pre-addressed parcel, filling in a CN23 paper form, and have that transcribed into Australia Post’s computer system by the postal worker behind the counter. You can elect to receive SMS notifications of change of status (landed, delivered, etc) for 50c.
Australia Post also allows you to fill in the appropriate details on their website; if you do this, then you get a QR code sent to you via SMS (free) and email (free) which the postal worker scans in and all the details (your name and address, destination name and address, contents, etc) are attached to your package’s details without any error-prone re-keying. The downside of going down this path is the dismal website Aussie Post provides, a JavaScript heavy, painfully slow dog of a site that doesn’t cache your own address.
Once the QR code is scanned, and the postal worker checks everything with you, they’ll print out the CN23, get you to sign it , and then it gets attached to your parcel. Because the To and From addresses are on the CN23 form (and those details are in electronic form, associated with the barcode for the package), it’s perfectly acceptable to present an unaddressed package to the post office (make sure you can tell which package is which, if you go down this route).
One thing you need to be aware of: Australia Post hasn’t heard of Unicode. You absolutely can’t use any characters not in the ASCII character set, and even then a very limited range of them. Certain fields allow some characters, which in turn aren’t allowed in other fields.
One of the fields you can supply is the HS tariff code, which is an international standard group of codes to describe “stuff” – the Harmonised System Tariff code. The sourcecode below uses the code for “Toy, plastic construction” – you should use the code for what you’re actually sending. You can specify multiple HS codes. Dollar values are in decimal dollars, weights are in decimal kilograms.
After calling the Australia Post website with your customs declaration, it returns to you a base-64 encoded PNG of the QR code to present at the counter, and a base-64 encoded PDF of the CN23 form – there’s no point printing this out, because it’s not paid for yet; let the Post Office print it out with the postage on it. You’ll also get the PNG via email and SMS (free).
Here’s some Python to make this submission:
AP_session = requests.Session()
jsonFormData = {"customDeclaration":{
"label":{"source":"AEM","postagePaidIndicator":False,"eadIndicator":False},
"parcelCharacteristics":{
"productClassification":11,
"dangerousGoodsIndicator":False,
"returnInstructions":"Return By Most Economical Route",
"confirmationMobileNumber":"0411111111",
"content":[{
"content":"HS traffic code name for your stuff",
"contentQuantity":1,
"contentUnitValue":subtotal,
"totalContentValue":subtotal,
"contentWeight":int(order["total_weight"])/1000,
"hsTariff":"95030039",
"contentCountryOfOrigin":"DK"
}],
"totalConsignmentValue":subtotal},
"senderAddress":{"firstName":"Josh","lastName":"FromGeekrant.org",
"addressLine":["11 Example St"],"suburb":"YourSuburbName","state":"VIC",
"postcode":"3000","email":"addr@example.com",
"phone":"0411111111","smsConfirmation":False,"countryCode":"AU"},
"receiverAddress":{"firstName":CustomsString(order["label_address_name_first"]),
"lastName":CustomsString(order["label_address_name_last"]),
"countryCode":order["label_address_two_char_country_code"],
"addressLine":CustomsAddress(order),
"suburb":CustomsString(order["label_address_city"]),
"state":CustomsString(order["label_address_state"]),
"postcode":CustomsString(order["label_address_postal_code"]),
"email":order["buyer_email"]}
}}
stopact = {"jsonFormData":json.dumps(jsonFormData) }
result = AP_session.post(url='https://auspost.com.au/bin/form/stopact',
data=stopact, timeout=2)
response = json.loads(result.text)
result.raise_for_status()
filename = "{}-customsQRcode.png".format(orderid)
with open(filename, "wb") as fh:
fh.write(base64.b64decode(response['qrCode']))
filename = "{}-CN23.pdf".format(orderid)
with open(filename, "wb") as fh:
fh.write(base64.b64decode(response['label']))