Close

Adding Paypal Smart Button to Website

<!-- PayPal Button -->
<script
	src="https://www.paypal.com/sdk/js?client-id=SB_CLIENT_ID&currency=USD"> // Required. Replace SB_CLIENT_ID with your sandbox client ID.
</script>
<div id="paypal-button-container" style="width:400px;"></div>        
<script>
paypal.Buttons({
	createOrder: function(data, actions) {
		// This function sets up the details of the transaction, including the amount and line item details.
		totAmt=1;
		return actions.order.create({
			purchase_units: [{
			amount: {
				value: totAmt
			}
			}]
		});
	},
	onApprove: function(data, actions) {
		// This function captures the funds from the transaction.
		return actions.order.capture().then(function(details) {
			// This function shows a transaction success message to your buyer.
			alert('Transaction completed by ' + details.payer.name.given_name);
			
			//jQuery("#wpforms-form-4").submit();
		});
	}
}).render('#paypal-button-container');
//This function displays Smart Payment Buttons on your web page.
</script>
<!-- PayPal Button -->

Leave a Reply

Your email address will not be published. Required fields are marked *