Skip to main content

Payment Buttons

Integrate hosted payment buttons into your website with just a few lines of code.

Overview

PaysGator Payment Buttons provide a seamless, secure checkout experience. Instead of building your own checkout forms, you can use our hosted solution that handles payment processing, security, and compliance.

Quick Start

1. Create a Payment Button

Go to Dashboard → Developers → Payment Buttons and create a new button. You'll receive a buttonKey (Public Key) for the button.

2. Add the Script

Include our JavaScript SDK in your HTML page:

<script src="https://paysgator.com/js/paysgator.js"></script>

3. Add a Payment Button

Use data attributes to quickly add a button:

<button 
data-paysgator-button="your_button_key"
data-amount="100.00"
data-currency="USD"
data-button-text="Pay Now"
>
Pay Now
</button>

JavaScript API (More Control)

Initialize programmatically for more control:

PaysGator.init({
buttonKey: 'your_button_key',
container: '#payment-button',
amount: 100.00,
currency: 'USD',

onSuccess: function(result) {
console.log('Payment successful!', result.transactionId);
},

onError: function(error) {
console.error('Payment failed:', error);
}
});

[!NOTE] Payment buttons use Public Keys (button keys) which are safe to use in client-side code. Your API Secret Keys for server-side requests must never be exposed.