Bongo API
Back to Bongous.com
United Kingdom / English
Back to Documentation

ConnectLandedCost

public static ConnectLandedCost ( Object ConnectLandedCostRequest )
    Return: Object ConnectLandedCostResponse

Calculate the total cost (Duties, Taxes and Shipping Costs) of a shipment to a specific country.

Section
Bongo Connect
Parameters
Object ConnectLandedCostRequest Required

Input object required by the function.

Length
String partnerKey Required

Required Key to access the functions of Connect API

45
String language Required

Defines the language in which the return error will be shown. Supported Languages.

2
String privateIndividuals Optional

Defines if the calculation is for a private individual or a non-private individuals like a business, group or organization. Default Y: private individuals, N: non-private indivisuals

1
Array items (Object ProductInfo ) Required

Items with their respective descriptions, ready for shipment from the vendor to Bongo International.

String shipmentOriginCountry Required

Defines the country of origin of shipment. Country Code List

2
String shipmentDestinationCountry Required

Defines the receiving country of shipment. Country Code List

2
Float domesticShippingCost Optional

Defines the cost of shipment from the company concerned to Bongo International.

Integer insuranceFlag Optional

Defines the inclusion or not of a shipping insurance from Bongo International to the final customer. Possible Values: 0 = No Loss and Damage Protection. 1 = Loss and Damage Protection

1
Integer currency Optional

Defines the currency in which the total amount will be returned in. 0=  US Dollar, 1= The currency of the shipping destination. Currency Code List

1
Float currencyConversionRate Optional

Defines the exchange rate between the currency of the shipping destination and the US Dollar


Integer service Optional

Defines the type of delivery, possible values: 0 = Express, 1 = Standard, 2 = Economy.

1
Return
Object ConnectLandedCostResponse

Object function return

Integer error

Numerical code error message.

String errorMessage

Text string describing the error message.

String errorMessageDetail

List of Insertion Errors

Float dutyCost

Total tax payable from Bongo International to the final customer.

Float taxCost

Total shipment Tax cost

Float shippingCost

Cost of shipping from Bongo International to the customer

Float insuranceCost

Total Loss and Damage Protection to pay for shipping from Bongo International to customer

String currencyCode

Currency code of the costs returned by the function

Integer ddpAvailable

Returns ddp (Delivery Duties Paid) availability for an item: 0 = No, 1 = Yes

String bongoExtendSignup

A Javascript that generates a button with which the customer may use to create Bongo International account from the vendors site

String landedCostTransactionID

Landed cost transaction identifier

Array items (Object LandedProduct )

Collection of LandedProduct indicating that products have been used to calculate the cost of shipping

Examples (3)

download example code

[1] ConnectLandedCost1.PHP

<?php$client = new SoapClient("https://api.bongous.com/services/v4?wsdl");$request = (object) array(    'partnerKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // please your partner key    'language' => 'en',    'shipmentOriginCountry' => 'US',    'shipmentDestinationCountry' => 'PE',    'domesticShippingCost' => '10',    'insuranceFlag' => '1',    'currency' => '1',    'currencyConversionRate' => '',    'privateIndividuals' => '',    'service' => '',    'items' => array(        array(            'productID' => '22710',            'quantity' => 2,            'price' => 100,        )    ));$response = $client->ConnectLandedCost($request);?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>    <head>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        <title>PHP Page</title>    </head>    <body>        <h1>ConnectLandedCost</h1>        <br /><strong>Error:</strong> <?php echo $response->error ?>        <br /><strong>ErrorMessage:</strong> <?php echo $response->errorMessage ?>        <br /><strong>ErrorMessageDetail:</strong> <?php echo $response->errorMessageDetail ?>        <br /><strong>Items:</strong> <?php echo print_r($response->items, true) ?>        <br /><strong>DutyCost:</strong> <?php echo $response->dutyCost ?>        <br /><strong>TaxCost:</strong> <?php echo $response->taxCost ?>        <br /><strong>ShippingCost:</strong> <?php echo $response->shippingCost ?>        <br /><strong>InsuranceCost:</strong> <?php echo $response->insuranceCost ?>        <br /><strong>CurrencyCode:</strong> <?php echo $response->currencyCode ?>        <br /><strong>DdpAvailable:</strong> <?php echo $response->ddpAvailable ?>        <br /><strong>BongoExtendSignUp:</strong> <?php echo $response->bongoExtendSignUp ?>        <br /><strong>LandedCostTransactionId:</strong> <?php echo $response->landedCostTransactionId ?>    </body></html>

[2] ConnectLandedCost2.Java

<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd"><html>    <head>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        <title>JSP Page</title>    </head>    <body>        <h1>ConnectLandedCost</h1>        <%            ws.BongoServiceV4Service service = new ws.BongoServiceV4Service_Impl();            ws.BongoServiceV4Port port = service.getBongoServiceV4Port();            ws.ProductInfo ProductIn = new ws.ProductInfo();            ProductIn.setProductID("22710");            ProductIn.setQuantity(2);            ProductIn.setPrice(100);            ws.ProductInfo[] items = new ws.ProductInfo[1];            items[0] = ProductIn;            ws.ConnectLandedCostRequest cRequest = new ws.ConnectLandedCostRequest();            cRequest.setPartnerKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");            cRequest.setLanguage("es");            cRequest.setShipmentOriginCountry("US");            cRequest.setShipmentDestinationCountry("PE");            cRequest.setDomesticShippingCost(10);            cRequest.setInsuranceFlag(1);            cRequest.setCurrency(1);            cRequest.setItems(items);            ws.ConnectLandedCostResponse cResponse = port.connectLandedCost(cRequest);            out.println("<br /><strong>Error:</strong> " + cResponse.getError());            out.println("<br /><strong>ErrorMessage:</strong> " + cResponse.getErrorMessage());            out.println("<br /><strong>ErrorMessageDetail:</strong> " + cResponse.getErrorMessageDetail());            out.println("<br /><strong>DutyCost:</strong> " + cResponse.getDutyCost());            out.println("<br /><strong>TaxCost:</strong> " + cResponse.getTaxCost());            out.println("<br /><strong>ShippingCost:</strong> " + cResponse.getShippingCost());            out.println("<br /><strong>InsuranceCost:</strong> " + cResponse.getInsuranceCost());            out.println("<br /><strong>CurrencyCode:</strong> " + cResponse.getCurrencyCode());            out.println("<br /><strong>DdpAvailable:</strong> " + cResponse.getDdpAvailable());            out.println("<br /><strong>BongoExtendSignUp:</strong> " + cResponse.getBongoExtendSignUp());            out.println("<br /><strong>LandedCostTransactionId:</strong> " + cResponse.getLandedCostTransactionId());        %>    </body></html>

[3] ConnectLandedCost3.VBNET

Imports System.DataImports com.bongous.apiPartial Class _Default    Inherits System.Web.UI.Page    Protected Sub AddItems_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddItems.Click        Dim strCadena As String        Try            strCadena = Me.ValidarItem()            If Not String.IsNullOrEmpty(strCadena) Then                Me.lblresult.Text = "Error de Validacion :"                Me.lblresult.ForeColor = Drawing.Color.Red                Me.lblresult.Text = strCadena                Me.lblresult.ForeColor = Drawing.Color.Red            Else                Me.lblresult.Text = "error acas"                If Not Me.AgregarItem Then                    Me.lblresult.Text = "Resultado :"                    Me.lblresult.ForeColor = Drawing.Color.Green                    Me.lblresult.Text = "- No se pudo agregar el item"                    Me.lblresult.ForeColor = Drawing.Color.Green                Else                    Me.lblresult.Text = String.Empty                    Me.lblresult.Text = String.Empty                End If            End If        Catch ex As Exception            Me.lblresult.Text = "Error de Aplicacion :"            Me.lblresult.ForeColor = Drawing.Color.Blue            Me.lblresult.Text = ex.Message            Me.lblresult.ForeColor = Drawing.Color.Blue        End Try    End Sub    Private Function AgregarItem() As Boolean        Dim dtItems As DataTable        Dim drItem As DataRow        Try            dtItems = CType(Session("items"), DataTable)            drItem = dtItems.NewRow            drItem.Item("ProductId") = Me.productid.Text.Trim            drItem.Item("Quantity") = Me.qty.Text.Trim            drItem.Item("Price") = Me.price.Text.Trim            dtItems.Rows.Add(drItem)            dtItems.AcceptChanges()            Me.productid.Text = String.Empty            Me.price.Text = String.Empty            Me.qty.Text = String.Empty            Me.gvItems.DataSource = dtItems            Me.gvItems.DataBind()            Return True        Catch ex As Exception            Throw        End Try    End Function    Private Function ValidarItem() As String        Dim intValue As Integer        Dim strResultado As String        Dim sinValue As Single        Try            strResultado = String.Empty            'validation product id            If String.IsNullOrEmpty(Me.productid.Text.Trim) Then                strResultado &= "Please type <b>Product ID</b><br/>"            End If            'validation quantity            If String.IsNullOrEmpty(Me.qty.Text.Trim) Then                strResultado &= "Please type <b> Quantity</b><br/>"            Else                Try                    intValue = Integer.Parse(Me.qty.Text.Trim)                Catch ex As Exception                    strResultado &= "Qty Product<b>is Incorrect</b><br/>"                End Try            End If            'validation price            If String.IsNullOrEmpty(Me.price.Text.Trim) Then                strResultado &= "Please type <b>Price</b><br/>"            Else                Try                    sinValue = Single.Parse(Me.price.Text.Trim)                Catch ex As Exception                    strResultado &= "Value Product<b>is Incorrect</b><br/>"                End Try            End If            Return strResultado        Catch ex As Exception            Throw        End Try    End Function    Public Function getItem() As ProductInfo()        Dim dtItems As DataTable        Dim lstItems() As ProductInfo        Try            dtItems = CType(Session("items"), DataTable)            With dtItems                ReDim lstItems(.Rows.Count - 1)                For intContador As Integer = 0 To .Rows.Count - 1                    lstItems(intContador) = New ProductInfo                    lstItems(intContador).productId = .Rows(intContador).Item("ProductId").ToString                    lstItems(intContador).quantity = Integer.Parse(.Rows(intContador).Item("Quantity").ToString)                    lstItems(intContador).price = Single.Parse(.Rows(intContador).Item("Price").ToString)                Next            End With            Return lstItems        Catch ex As Exception            Throw        Finally            lstItems = Nothing            dtItems = Nothing        End Try    End Function    Private Function validateform() As String        Dim caderror As String        Try            caderror = String.Empty            If CType(Session("items"), DataTable) Is Nothing Then                caderror &= "Please type <b>Items</b> for ConnectLandedCostCalculator<br />"            Else                If CType(Session("items"), DataTable).Rows.Count = 0 Then                    caderror &= "- please type <b>Items</b> for  ConnectLandedCostCalculator<br />"                End If            End If            Return caderror        Catch ex As Exception            Throw        End Try    End Function    Protected Sub Process_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Process.Click        Dim objBongoApi As New BongoServiceV4Service        Dim objinput As New ConnectLandedCostRequest        Dim objresult As New ConnectLandedCostResponse        Try            objinput.partnerKey = Me.partnerkey.Text            objinput.shipmentOriginCountry = Me.shipmentOriginCountry.Text            objinput.shipmentDestinationCountry = Me.shipmentDestinationCountry.Text            objinput.domesticShippingCost = Single.Parse(Me.domesticShippingCost.Text)            objinput.insuranceFlag = Integer.Parse(Me.insuranceFlag.Text)            objinput.currency = Integer.Parse(Me.currency.Text)            objinput.currencyConversionRate = Single.Parse(Me.currencyConversionRate.Text)            objinput.service = Integer.Parse(Me.service.Text)            objinput.language = Me.language.Text            objinput.items = Me.getItem            objresult = objBongoApi.ConnectLandedCost(objinput)            Me.lblresult.Text = "error: " & objresult.error & "<br/>" & _                           "errorMessage: " & objresult.errorMessage & "<br/>" & _                           "landedCostTransactionId: " & objresult.landedCostTransactionId & "<br/>" & _                           "dutyCost: " & objresult.dutyCost & "<br/>" & _                           "taxCost: " & objresult.taxCost & "<br/>" & _                           "shippingCost: " & objresult.shippingCost & "<br/>" & _                           "insuranceCost: " & objresult.insuranceCost & "<br/>" & _                           "currencyCode: " & objresult.currencyCode & "<br/>" & _                           "ddpAvailable: " & objresult.ddpAvailable & "<br/>" & _                           "bongoExtendSignUp: " & objresult.bongoExtendSignUp & "<br/>" & _                           "errorMessageDetail: " & objresult.errorMessageDetail & "<br/>"        Catch ex As Exception            Me.lblresult.Text = ex.ToString ' .InnerException.Message ' ex.Message.ToString        End Try    End Sub    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        Dim dtItems As DataTable        Try            If Not Page.IsPostBack Then                dtItems = New DataTable                dtItems.Columns.Add(New DataColumn("ProductId", Type.GetType("System.String")))                dtItems.Columns.Add(New DataColumn("Quantity", Type.GetType("System.String")))                dtItems.Columns.Add(New DataColumn("Price", Type.GetType("System.String")))                Session("items") = dtItems                Me.gvItems.DataSource = dtItems                Me.gvItems.DataBind()            End If        Catch ex As Exception        Finally            dtItems = Nothing        End Try    End SubEnd Class