{"openapi":"3.0.1","info":{"title":"1CC Merchant Webhooks","description":"This API Spec defines the APIs required to be created by merchants to integrate with 1CC","version":"1.0.0"},"tags":[{"name":"Shipping Info","description":"Shipping Info is collection of relations between an order and delivery information such as serviceability, shipping and cod charges etc."},{"name":"Coupon","description":"Coupons refer to promotional codes that will impact cart, shipping or cod charges"}],"paths":{"/shipping_info":{"post":{"tags":["Shipping Info"],"summary":"Get the shipping info for the checkout","operationId":"getShippingInfo","requestBody":{"description":"Object that needs to be sent to receive the required information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShippingInfoRequest"}}},"required":true},"responses":{"200":{"description":"successful retrival","content":{"application/json":{"schema":{"type":"object","properties":{"addresses":{"type":"array","items":{"$ref":"#/components/schemas/ShippingInfoResponse"}}}}}}},"400":{"description":"Invalid merchant_order_id","content":{}}}}},"/get_coupons":{"post":{"tags":["Coupon"],"summary":"Get all applicable coupons for the checkout","operationId":"getCoupons","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCouponsRequest"}}},"required":true},"responses":{"200":{"description":"Successful retrieval","content":{"application/json":{"schema":{"type":"object","properties":{"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}}}}}}}}}},"/apply_coupon":{"post":{"tags":["Coupon"],"summary":"Returns the state of the cart post coupon application","operationId":"applyCoupon","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponRequest"}}},"required":true},"responses":{"200":{"description":"Successful application of the coupon","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponResponse"}}}},"400":{"description":"Unsuccessful application of coupon","content":{"application/json":{"schema":{"type":"object","properties":{"failure_code":{"type":"string","enum":["invalid_code","auth_required"]},"failure_reason":{"type":"string"}}}}}}}}}},"components":{"schemas":{"price":{"type":"integer","format":"int64","example":50},"order_id":{"type":"string","description":"Merchant Order Id"},"contact":{"type":"string","format":"phone number","example":"+91-1234567890"},"email":{"type":"string","format":"email"},"ShippingInfoRequest":{"required":["order_id","addresses"],"type":"object","properties":{"order_id":{"$ref":"#/components/schemas/order_id"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/ShippingInfoRequestAddress"}}}},"ShippingInfoRequestAddress":{"required":["zipcode","state","country"],"type":"object","properties":{"zipcode":{"type":"string"},"state":{"type":"string"},"country":{"type":"string"}}},"ShippingInfoResponse":{"required":["zipcode","country","serviceable","cod","shipping_fee"],"type":"object","properties":{"zipcode":{"type":"string"},"country":{"type":"string"},"serviceable":{"type":"boolean"},"cod":{"type":"boolean"},"cod_fee":{"type":"integer","format":"int64"},"shipping_fee":{"type":"integer","format":"int64"},"id":{"type":"integer","format":"int64"}}},"GetCouponsRequest":{"required":["order_id"],"type":"object","properties":{"order_id":{"$ref":"#/components/schemas/order_id"},"contact":{"$ref":"#/components/schemas/contact"},"email":{"$ref":"#/components/schemas/email"}}},"Coupon":{"required":["code"],"type":"object","properties":{"code":{"type":"string"},"summary":{"type":"string"},"description":{"type":"string"},"tnc":{"type":"array","items":{"type":"string"}}}},"ApplyCouponRequest":{"type":"object","required":["order_id"],"properties":{"order_id":{"$ref":"#/components/schemas/order_id"},"contact":{"$ref":"#/components/schemas/contact"},"email":{"$ref":"#/components/schemas/email"},"coupon_code":{"type":"string"}}},"promotion":{"type":"object","properties":{"reference_id":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"value":{"type":"integer"},"value_type":{"type":"string"},"description":{"type":"string"}}},"line_item":{"type":"object","properties":{"sku":{"type":"string"},"variant_id":{"type":"string"},"price":{"$ref":"#/components/schemas/price"},"offer_price":{"$ref":"#/components/schemas/price"},"tax_amount":{"$ref":"#/components/schemas/price"}}},"ApplyCouponResponse":{"type":"object","properties":{"promotion":{"type":"object","$ref":"#/components/schemas/promotion"},"amount":{"type":"integer","format":"int64"},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/line_item"}},"shipping_fee":{"$ref":"#/components/schemas/price"},"cod_fee":{"$ref":"#/components/schemas/price"},"line_items_total":{"$ref":"#/components/schemas/price"}}}}}}