Quick Start
Welcome to Mileston Payments Integration! ๐ Weโre thrilled to have you onboard! Integrating Mileston Payments is simple, fun, and opens your app to the world of crypto payments. Letโs dive in and create your first crypto payment link in just a few steps!
Quick Start: Create Your First Crypto Payment Link ๐โ
Step 1: Create an Account ๐โ
Head over to business.mileston.co and sign up for your Mileston Business account.
This will give you access to our powerful dashboard where all the magic happens. โจ
Step 2: Get Your API Key ๐โ
Navigate to the Developers tab in the dashboard to generate your API key. Youโll find two types of keys:
-
Test API Key (for testnet, no real money involved):
Mileston_TEST_hshshs7y373djdsdj...
-
Live API Key (for mainnet, real monetary value):
Mileston_PROD_773hsiakakgddh...
โ ๏ธ Pro Tip:
To generate the right key:
- Switch to Test mode in the dashboard for the Test API key.
- Switch to Live mode for the Live API key.
Step 3: Install the Backend SDK ๐ ๏ธโ
Install our backend SDK to start creating payment links like a pro. Here's how:
npm install mileston-payments
Then, write some magic code like this:
import { PaymentLink } from 'mileston-payments';
const apiKey = 'your-api-key'; // Your API key
const businessId = 'your-business-id'; // Your business ID
// Initialize PaymentLink, Invoice, or RecurringPayment as needed
const paymentLink = new PaymentLink(apiKey, businessId);
// Generate a payment link
const link = await paymentLink.create({
amount: 100, // Amount in your preferred currency
currency: 'USD',
description: 'Crypto Payment Example',
});
console.log('Payment link created:', link);
๐ Where to find your businessId
?
You can grab your Business ID from the dropdown menu under your business logo in the dashboard.
Step 4: Use the Payment Link in Your Frontend โจโ
Now that youโve created a payment link, letโs add it to your frontend!
You can either:
- Build your own custom button, or
- Use our mileston-payment-client SDK for seamless integration.
First, install the client SDK:
npm install mileston-payment-client
Then, use our prebuilt payment button:
import { PayButton } from 'mileston-payment-client';
const App = () => (
<PayButton
paymentUrl="https://checkout.mileston.co/payment"
onPaymentComplete={() => console.log('Payment complete!')}
onPaymentDataReceived={(data) => console.log('Payment data received:', data)}
onPaymentError={(error) => console.error('Payment error:', error)}
style={{ backgroundColor: 'green', color: 'white' }}
>
Pay Now
</PayButton>
);
๐ Why use the PayButton
?
It handles everything: payment, verification, and an awesome user experience. You just sit back and sip coffee. โ
Step 5: Keep API Keys Safe! ๐ก๏ธโ
Important: Always use the backend SDK for API keys. Never expose your keys in the frontend, or youโll have a bad time.
GitHub Repos ๐โ
Check out our SDKs for more details and examples:
๐ Congrats!
Youโve just created your first crypto payment link with Mileston Payments! High five! ๐
Whatโs Next?โ
Dive deeper into each tool and feature in the full documentation to unlock even more power.
Happy coding, and may your payments always succeed on the first try! ๐ช๐ฅ