Our Pricing API
In my first month as an Associate Engineer, I picked up a ticket for improvements on our Pricing API, which we launched last year. However, for those relying mainly on sales and discounts, a problem occured where they couldn’t show the original price using the Pricing API when there were ongoing sales, so we decided to make it better!
This required changing the way the
was returned as a response from the API.
A typical pricing API response would look like this:
The challenges we encountered
The problem was ocurring when we had a sale applied to the product, as the
used to be the same as
with the sale applied. This meant that if our sellers had ongoing sales for their products, they couldn’t show the original price of the product to highlight how much discount their customers were getting.
The solution was simple. Make a change so that
returns the original price of the product, if the product had an ongoing sale applied to it.
£100 => £50 [ 50% discount ]
The impact of the API
We rolled out this change making a positive impact for a lot of our sellers, especially those who rely heavily on frequent sales and discounts for their products. Following this change our sellers can how do this on their website using the Pricing API responses, which makes it easier for them to highlight the discounts and attract more buyers and thus make more sales.
Here are some typical responses from Pricing API with various scenarios.
1 : When you have no discount on the product with no active sale applied:
2: When you have 20% discount coupon on the product with no active sale applied:
3: When you have no discount coupon on the product with 20% discount sale applied:
4: When you have 15% discount coupon on the product with 10% discount sale applied:
What I learned
This was a good first ticket for me to pick-up how a pricing API works. I now know that if we specify multiple coupons in the request (either a percentage or flat or both), the API will calculate the price based on the coupon that gives the highest discount. Sweet!!
Delighting our customers is one of our core values, so I was pretty pleased to improve a service that enhanced our sellers' checkouts - and looking forward to the next project!