Jump to content

Paypal Button Code

Recommended Posts

Site URL: https://gatewaynaturepreserve.org/spring-into-art-sale

We are hosting a virtual art sale fundraiser for our organization. I used a code to add paypal pay buttons/credit card pay buttons to each item in the store. The payment goes through when someone makes an order but the item is not marked sold, in addition, it doesn't tell me which item was sold just the amount that was paid. Can you please help me solve this issue? Is there something I can add to the code to make it record the sold item as well as specify which item was paid for?

This is the code I used, just changed the value to reflect the price of each of the items:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Ensures optimal rendering on mobile devices. -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Optimal Internet Explorer compatibility -->
  </head>

  <body>
    <script src="https://www.paypal.com/sdk/js?client-id=ATxUbt3GpgXOZ362Wh5NhG-hA5DJrXMLwxwvJxuo0TThwiJTuyUUAkpfTb6YYLJ_oJexD_lWAHElcNNL"> // Replace YOUR_CLIENT_ID with your sandbox client ID
    </script>

    <div id="paypal-button-container"></div>

    <!-- Add the checkout buttons, set up the order and approve the order -->
    <script>
      paypal.Buttons({
        createOrder: function(data, actions) {
          return actions.order.create({
            purchase_units: [{
              amount: {
                value: '0.01'
              }
            }]
          });
        },
        onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
            alert('Transaction completed by ' + details.payer.name.given_name);
          });
        }
      }).render('#paypal-button-container'); // Display payment options on your web page
    </script>
  </body>
</html>

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,
If you haven't received an answer yet, you can post on some FB groups
+ Squarespace Customization Resource Groups
+ Squarespace Community
+ Squarespace Entrepreneur
+ Squarespace Rockstars

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 4/21/2021 at 8:42 PM, GatewayNaturePreserve said:

We are hosting a virtual art sale fundraiser for our organization. I used a code to add paypal pay buttons/credit card pay buttons to each item in the store. The payment goes through when someone makes an order but the item is not marked sold

It isn't possible to integrate a third-party payment method with Squarespace commerce. As you've found, if you use code to add a payment method, all the processing will happen on the third-party system. It will NOT happen on Squarespace, so you Squarespace won't be able to manage order processing, notifications, inventory management, shipping or anything else. 

Can you explain why you haven't used the built-in payment methods (PayPal and Stripe) to take payment? This doesn't require any code as it is built into Squarespace.

About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.