Pagsmile JavaScript
Updated on 2024.7.24
Pagsmile Payment Gateway Integration Guide
This guide provides step-by-step instructions for integrating Pagsmile into your website for seamless payment processing. Pagsmile offers robust features and security measures to ensure smooth transactions for your customers.
Prerequisites
Pagsmile Account: Ensure you have signed up for a Pagsmile account. You will need your
app_id
andpublic_key
provided by Pagsmile.Environment: Access to your website's HTML and JavaScript files for integration.
Step 1: Include Pagsmile Script
Add the Pagsmile JavaScript library to the <head>
section of your HTML file. This script is necessary to initialize and interact with the Pagsmile API.
Step 2: Initialize Pagsmile
After the page loads and the Pagsmile script has loaded, initialize Pagsmile with your credentials (app_id
and public_key
) other mandatory parameters. This step prepares Pagsmile for handling payment transactions securely.
Step 3: Handle Payment Form Submission
Use createOrder method of returned clientinstance and initialize payment upon user submission. Check Brazil, Europe, or North America. Once you get status: "success" query transaction status with help of related backend endpoints.
createOrder Optional Parameters
Installments: installments
parameter should be provided if there is installment information is returned by Installment Detail Query endpoint.
Step 4: Testing and Deployment
Sandbox Mode: During development and testing, use
env: "sandbox"
. Verify that payments process correctly and error handling works as expected.Production Mode: Before deploying to production, change the
env
setting to"prod"
.
Last updated