OriginProtocol / dshop

Origin Dshop - launch your own decentralized store
https://www.originprotocol.com/dshop
MIT License
138 stars 87 forks source link

Make commission for Affiliates variable #69

Open gullible1 opened 4 years ago

gullible1 commented 4 years ago

Right now our affiliate commission is hardcoded as 2 OGN per $1 spent.

Let's make this variable so that each merchant is able to set their own rates.

franckc commented 4 years ago

Just to clarify, do we want to allow the merchant to set their own rate? Since we'll initially be paying for the commission, should we for now keep this as an internal config that we control?

nick commented 4 years ago

I think the merchant should be able to set their own rate, and perhaps specify it in the same currency as their products (ie USD initially). They should also be able to specify it is a fixed amount, or %. The exchange rate at the time of transaction should probably also be stored.

Fixed amount:

{
  "commissionPolicy": {
    "currency": "fiat-USD",
    "type": "fixed",
    "amount": "2.00",
    "minimumSpend": "10.00"
  }
}

Percentage:

{
  "commissionPolicy": {
    "currency": "fiat-USD",
    "type": "percentage",
    "amount": "5",
    "minimumSpend": "10.00"
  }
}

Offer:

{
  "listingId": "999-001-123",
  "currency": "fiat-USD",
  "amount": "25.00",
  "commission": {
    "originalPolicy": {
      "currency": "fiat-USD",
      "type": "percentage",
      "amount": "5",
      "minimumSpend": "10.00"
    },
    "exchangeRate": "0.246152",
    "amount": "6.15"
  }
}
franckc commented 4 years ago

Makes sense.

Though in the short-term while Origin is paying for the commission out of pocket (vs the merchant paying it), I'm still worried about merchants abusing the system by updating their config and setting a very high commission. Especially once we open up the deployer for example to unstoppable domain. That's why I was inclined to initially not make those configs writable by the merchant (we would update in the back-end using a script). Any thoughts on that?

nick commented 4 years ago

I think we need to be careful of this regardless to prevent token beggars gaming the system. Otherwise anyone can just generate wash transactions and there'd be no way for us to know. Perhaps Origin should only pay OGN to certain, known affiliates, or only on certain stores?

gullible1 commented 4 years ago

I agree that at least for now we should decide which affiliates to pay OGN to. If it's easier for us to control in the near term, maybe we should keep it as an internal config first?

nick commented 4 years ago

I just looked at the marketplace code and only the seller can add OGN to their listing... so we'd need to manage the seller's wallet anyway in order to pay out OGN if we want to do everything at the contract level. Alternatively, we can handle commission payments by some other method in which case we can control by an internal config.

franckc commented 4 years ago

How about I start with this:

  1. Config is only writable by Origin for now using a back-end script. Engineering will have to run it manually but it's not a big deal since it will be a few shops to start with. We can figure out later if it's worth having a UI for it (perhaps only the Origin super-admin can use it).
  2. Config is exposed read-only to the Merchant in the shop admin interface
  3. Payout script is run by Origin on a monthly basis and only pays out to affiliates of Merchants that are hosted on our back-end and that had the commission configured via step 1 above.
nick commented 4 years ago

Sounds good to me. We can work on merchant-managed commissions later.

phyninja commented 2 years ago

@franckc @nick @gullible1 Having referenced a few postings about Origin's Affiliate program, I'm concluding that the latter is currently at least dormant. Is there a need to keep this issue open?

Relevent links: Origin Blog - Announcing Origin Commissions for Dshop Github issue - Decouple Affiliates from Origin Rewards

franckc commented 2 years ago

@phyninja Yes, you are correct. The affiliate program is not active at this point.