1

I'm thinking about setting up a simple affiliate system. Here's what I want to happen.

  1. Creator put’s their product into the system, and they get a special code.
  2. Affiliate, also gets the code, and put’s a button on their website
  3. When a user on the affiliates website clicks on the button, they get taken to the creators product page, where they can see another button to buy the product.
  4. The user clicks on the button and buys the product with paypal.

Questions...

how would a system know that the user has purchased the product? I presume there must be some kind of JS on the product buy button, which checks the user's code against the products code? But then also how will the purchase be registered in the affiliate system? Because the user can back out of the paypal purchase even after clicking on the product buy button.

Does need some kind of integration with the paypal API?

Phil
  • 2,995
  • 6
  • 40
  • 67

1 Answers1

1

What PayPal could help with in this case, is to pass your "custom code" (associated with the product/affiliate sys) and return it (in the async call-back message called IPN) when the payment is completed

Use JS or form variables to pass an "affiliate system ID" along with the product code, when user clicks to purchase from an affliate system

The system obtains the "affiliate sys ID" and set it into the payment button (form tag, use the custom field)

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="get">
  <input type="hidden" name="cmd" value="_xclick">
  <input type="hidden" name="business" value="usm@email.com">
  <input type="hidden" name="item_name" value="Test Product">
  <input type="hidden" name="amount" value="1.0">
  <input type="hidden" name="currency_code" value="USD">
  <input type="hidden" name="custom" value="affiliate sys ID obtained from query string or JS">
  <input type="hidden" name="return" value="http://returnAddress">
  <input type="hidden" name="notify_url" value="http://IPNListener">
  <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

User clicks the payment button and is redirected to PayPal checkout page, authorize and complete the payment.

Async IPN messages will be sent to the system, containing custom=affiliate sys ID so that you know which affiliate sys should the trasanction be registered on.

Additionally, if you need to register a purchase even if the user backs out the payment, put some JS on the payment button form so that every user click is recorded (with the affiliate sys ID) in to the database, this part has nothing to do with PayPal though

Payment button code is simple & straight forward but if you'd integrate with APIs e.g. Express Checkout, the approach works as well Express Checkout API reference

pp_pduan
  • 3,392
  • 1
  • 9
  • 15