Search code examples
paypalpayment-gatewaybluesnap

Adding discount to a bluesnap shopper request


I'm using the bluesnap shopper API in order to create a shopper form: https://developers.bluesnap.com/v8976-Extended/docs/create-shopper

This is the url i'm sending:

https://sandbox.bluesnap.com/buynow/checkout?
storeId=xxxxx&
skinId=xxxx&
skuxxxxx=1&
currency=USD&
shopper.firstName=some_name&
shopper.lastName=some_lastName&
shopper.email=test_email@bla.com&
shopper.address1=Rotunda%20Drive&
shopper.city=Dearborn&
shopper.state=Mi&
shopper.zip=481201230&
shopper.phone=05444444&
shopper.country=us&
enc=xab1b2b4k55trtg
&sellerorderid=bs_xxx

And it works great for me.

Now, I want to add a discount field, and i couldn't figure out from the shopper's API how can i add it? If you can attach the url that i need to send?


Solution

  • You could use one of two ways to make sure your shopper receives a discount on purchase from the BlueSnap catalog price:

    1) implement a coupon. store it in your system associated with the shopper you created. Then, use the orders web service to place an order for the shopper with the discount:

    https://ws.bluesnap.com/services/2/orders  POST
    
    <order xmlns="http://ws.plimus.com">
      <ordering-shopper>
        <shopper-id>19575992</shopper-id> -- the shopper ID you prepared in advance
        <web-info>
          <ip>62.219.121.253</ip>
          <remote-host>www.merchant.com</remote-host>
          <user-agent>Mozilla/5.0 (Linux; X11)</user-agent>
        </web-info>
      </ordering-shopper>
      <cart>
        <cart-item>
          <sku>
            <sku-id>2152762</sku-id> -- a product that has catalog price of 10 usd
          </sku>
          <quantity>1</quantity>
        </cart-item>
        <coupons>
          <coupon>30-percent-off-code</coupon> -- the coupon code you made for the shopper.
        </coupons>
      </cart>
      <expected-total-price>
        <amount>7.00</amount> -- the price for this shopper after the discount
        <currency>USD</currency>
      </expected-total-price>
    </order>
    

    2) Use override price. In this case, you can control exactly how much of a discount the shopper gets, regardless of the catalog price:

    <order xmlns="http://ws.plimus.com">
      <ordering-shopper>
        <shopper-id>19575992</shopper-id>
        <web-info>
          <ip>62.219.121.253</ip>
          <remote-host>www.merchant.com</remote-host>
          <user-agent>Mozilla/5.0 (Linux; X11)</user-agent>
        </web-info>
      </ordering-shopper>
      <cart>
        <cart-item>
          <sku>
            <sku-id>2152762</sku-id>
            <sku-charge-price>
              <charge-type>initial</charge-type>
              <amount>7.00</amount>
              <currency>USD</currency>
            </sku-charge-price>
          </sku>
          <quantity>1</quantity>
        </cart-item>
      </cart>
      <expected-total-price>
        <amount>7.00</amount>
        <currency>USD</currency>
      </expected-total-price>
    </order>
    

    In both cases, the product that costs 10 USD for anyone else will be sold to the shopper you selected for 7 USD.