PayPal Smart Buttons are not working on my website; transaction not posting.

whitecfb
Contributor
Contributor

I've created a PayPal Smart Button and copied the HTML code to my website. When I do a test, it lets me enter all of the information for shipping, billing, and payment into the fields and concludes the transaction with a "Thank you for your payment" notification.  However, the transaction is not showing up in my PayPal account. No funds are transferred and no email notification is sent to us from PayPal.  TEST FAILED!

 

Here is the HTML code that PayPal told me to copy to my website...

 

<div id="smart-button-container"> <div style="text-align: center;"> <div id="paypal-button-container"></div> </div> </div> <script src="https://www.paypal.com/sdk/js?client-id=sb&enable-funding=venmo&currency=USD" data-sdk-integration-source="button-factory"></script> <script> function initPayPalButton() { paypal.Buttons({ style: { shape: 'rect', color: 'silver', layout: 'vertical', label: 'pay', }, createOrder: function(data, actions) { return actions.order.create({ purchase_units: [{"description":"2022 White County, Illinois Plat Book","amount":{"currency_code":"USD","value":50.2,"breakdown":{"item_total":{"currency_code":"USD","value":40},"shipping":{"currency_code":"USD","value":7},"tax_total":{"currency_code":"USD","value":3.2}}}}] }); }, onApprove: function(data, actions) { return actions.order.capture().then(function(orderData) { // Full available details console.log('Capture result', orderData, JSON.stringify(orderData, null, 2)); // Show a success message within this page, e.g. const element = document.getElementById('paypal-button-container'); element.innerHTML = ''; element.innerHTML = '<h3>Thank you for your payment!</h3>'; // Or go to another URL: actions.redirect('thank_you.html'); }); }, onError: function(err) { console.log(err); } }).render('#paypal-button-container'); } initPayPalButton(); </script>

 

I'm not sure what else I need to do.  Thanks for assisting!

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Good day @whitecfb,

 

Thank you for posting to the PayPal community.

 

Reported Smart button code belongs to sandbox test environment, the payment attempt/notification will be directed to your sandbox test account. Please login to your sandbox account to access the test payment attempts and email notifications.

 

By default, PayPal system will generate Smart button code in Sandbox environment and merchant can test the integration using sandbox accounts.

Merchants need to create LIVE REST API credentials and pass/enter the LIVE API credentials in the Smart button code in order to receive payments in LIVE production.


I request to please follow the below steps to create LIVE REST API credentials via your PayPal account. 

Login to https://developer.paypal.com/  >> My apps & credentials >> toggle "LIVE" >> create "App" >> fill required details >> you can able to access your LIVE REST API Credentials(Client ID & Secret).

Guide link for REST API Credentials - 
https://developer.paypal.com/api/rest/#get-credentials

Once you create LIVE REST API credentials (Client ID & Secret), please enter/pass the Client ID in your button code as below. 

Present button code implemented on your website, pointing to Sandbox :

 

<script src="https://www.paypal.com/sdk/js?client-id=sb&enable-funding=venmo&currency=USD" data-sdk-integration-source="button-factory"></script>

Pass the LIVE "Client_ID" as below to process payments in LIVE :

 

<script src="https://www.paypal.com/sdk/js?client-id=Enter_the_Client_ID_value_here&enable-funding=venmo&currency..." data-sdk-integration-source="button-factory"></script> 

I request to please use the updated button code on your website and process a test payments via card which is not linked to your PayPal account. Since, merchant can't process self payments. 

 

Thank you so much for your patience and understanding.

 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.