SDKs & Integration Patterns
Accelerate your development cycle with our official libraries.
SamaPay provides first-class wrappers to handle the heavy lifting of signing, currency conversion, and error handling.
Node.js Integration (Official)
Install the SDK to handle authentication and session management automatically.
npm install @samapay/sdk-node
Usage Pattern
import { SamaPay } from '@samapay/sdk-node';
const client = new SamaPay({
apiKey: process.env.SAMA_SECRET_KEY,
environment: 'production'
});
// Create a high-converting checkout session
const session = await client.checkout.sessions.create({
amount: 2500,
currency: 'GMD',
customer_reference: '998877',
success_url: 'https://myshop.gm/success',
metadata: {
category: 'electronics',
shop_id: 'serrekunda_01'
}
});
console.log(`Redirect user to: ${session.checkout_url}`);
Community SDKs
- Python: techhive-gm/samapay-python
- PHP/Laravel: sama-community/laravel-bridge
Frontend SDK: SamaPay.js (Embedded)
For the ultimate user experience, use our embedded modal checkout. This keeps customers on your site, leading to 35% higher conversion rates in the Gambian market.
1. Include the Script
Add our universal bridge to your HTML head.
<script src="https://samapay.techhive.gm/v1/samapay.js"></script>
2. Launch the Checkout
Call the checkout method with your checkoutId generated from your backend.
SamaPay.checkout({
id: 'ck_123456789', // The ID from your SERVER session creation
onTransaction: (payload) => {
console.log('Payment Successful:', payload);
alert('Thank you for your purchase!');
},
onClose: () => {
console.log('User closed the checkout modal');
}
});
The embedded modal supports SamaPay Passport, allowing your repeat customers to pay with a single tap using their saved Wave credentials.