Mich
Mich

Reputation: 3594

Adding a paypal purchase button to a website with price and description

I can add a paypal button with an internal paypal shopping cart using paypal generated buttons, however, I would like to use my own custom shopping cart that I built in javascript

And use the paypal button to send the customer to purchase page with the total price in the shopping cart.

Then I would also need paypal to somehow send me an email with the description of the shopping cart, and customer details

So far I find the paypal button options very limiting

Also I dont have a paypal business account.

My code looks something like this

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
      <input type="hidden" name="cmd" value="_s-xclick"></input>
      <table>
        <tr><td><input type="hidden" name="on0" value="Menu"></input>Menu</td></tr><tr><td><select name="os0">
          <option value="Option 1">Option 1 $20.00 USD</option>
        </select> </td></tr>
      </table>
      <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----LONG LONG ENCODED STRING"></input>
      <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!"></input>
      <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></img>
    </form>

I was thinking to programmatically change the value of Option 1 in Javascript with the total in shopping cart, and simply hide the input. But its just text, the actual value is encoded in the string.

Is there any way to do this with paypal? Or do I need to sign up for the business account? Are there better free options for ecommerce that process CC payments securely?

Thanks,

Upvotes: 0

Views: 498

Answers (1)

Preston PHX
Preston PHX

Reputation: 30432

You will need a PayPal business account to do business with PayPal. Upgrading one is free.

As far as the integration and receiving payments, the old HTML-only buttons should not be used. There are two good options:

Edit: there is a third option now for simple integrations: the new Pay Links and Buttons via https://www.paypal.com/buttons/

  • Integrate the current standard checkout. This will involve creating two backend routes to create and capture the order, respectively. Since you mention react, you can use the official @paypal/react-paypal-js for the frontend portion. However do not use actions.order.create nor actions.order.capture, as these are deprecated. Create two backend routes that call the v2/checkout/orders API to create and capture the order, respectively.
  • Or rather than building your own, use a pre-integrated shopping cart solution. Virtually every significant ecommerce shopping cart solution ever made can integrate with PayPal as a payment processor, so you can simply search for one with whatever parameters make sense for your host/environment -- or start with its partner directory if you find that helpful.

Upvotes: 1

Related Questions