Skip to main content

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!


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.


Now that youโ€™ve created a payment link, letโ€™s add it to your frontend!

You can either:

  1. Build your own custom button, or
  2. 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! ๐Ÿ’ช๐Ÿ”ฅ