If you are a developer and have access to an API you can use our 3rd party shipping rate feature to pull in a custom rate for customers on checkout.

Note: This feature is dependent on a 3rd party API that can return a price when it's passed data from a customer checkout. It will require developer support.

1. Setup a new shipping rule and select "3rd party integration" from the list of shipping rule types. https://app.paywhirl.com/shipping

2. Give the rule a name and define a default price if a custom rate is not used. For example, $0.00 is a normal value for default price if no rate is returned by the API.

3. Define an API request endpoint. This should be a valid URL that points to an API that can return information when sent data from a checkout. In the example URL below we are sending three values from the customer (country, city, and zip code).

Example Request Endpoint

https://my-custom-shipping-rate-api.com/api/get_custom_rate?CustomerCountry={{customer.country}}&CustomerCity={{customer.city}}&CustomerZipcode={{customer.zip}}

Customer Variables                         
----------------------------------------------------------------------
{{ customer.id }} Customer ID
{{ customer.first_name }} First name
{{ customer.last_name }} Last name
{{ customer.email }} Email
{{ customer.phone }} Phone
{{ customer.address }} Street Address
{{ customer.city }} City
{{ customer.state }} State/Province
{{ customer.zip }} Zip/Postal Code
{{ customer.country }} Country Code
{{ customer.utm_source }} Acquisition Source
{{ customer.utm_medium }} Acquisition Medium
{{ customer.utm_term }} Acquisition Keyword/Search Term
{{ customer.utm_content }} Acquisition Ad Content
{{ customer.utm_campaign }} Acquisition Ad Campaign
{{ customer.utm_group }} Acquisition Ad Group

Optionally, you can define a key via the "request headers" value to increase security and make sure the calls originate from PayWhirl. The request headers key should be in the following format.

{"X-API-Key":"XXXXXXXXXXXX_KEY-HERE_XXXXXXXXXXXX"}

The API needs to return JSON data back when called with the pricing for the custom shipping rate. The API can return several values back, but Paywhirl will need to know which value is the one that should be used to populate the custom rate.

Example API Response

{ 
"shipping_rate_1": "10.00",
"shipping_rate_2": "15.00",
"shipping_rate_3": "25.00"
}

4. Identify the value that should be used by defining a KEY in the "response mapping" field in the PayWhirl settings.

For example, if you want PayWhirl to use the price value "shipping_rate_2" in the example above you would define the response mapping field as "shipping_rate_2" and the price would be $15.00 for the custom rate.

5. Decide if the price should be per item (multiplied by the quantity purchased) or just a single price for the entire checkout, regardless of quantity.

6. Lastly, decide if you'd like to block the checkout if a price is not returned successfully and write the error message that should be displayed to the customer in this circumstance.

That's it! Please let us know if you have any questions. We'll do our best to help, however, please keep in mind that we are unable to provide support on custom development or assist with testing of the required APIs.

Related Articles:

Sincerely,

The PayWhirl Team

Did this answer your question?