Resmic
  • Resmic SDK
    • 👋Introduction
      • ðŸŠķOverview
    • ðŸ’ŦGetting Started
      • 🏃Installation
      • ðŸ‘ūUsage
        • CryptoPayment
        • For Starknet
        • For EVM
      • 📃Reference
    • 💁Support
      • ⛓ïļBlockchain
      • 🊙Tokens
      • 💰Wallets
    • 🊄Demo
      • Sample React app
    • 📰Whitepaper
      • Github
    • 🛂Contact
  • Resmic Pro
    • Introduction to Resmic Pro
    • Getting Started
    • API Authentications & Security
    • Payment Integration
    • Order Status
    • Transaction Details
    • Webhooks & Notifications
    • Supported Chains & Tokens
    • iFrame
    • Demo
      • Sample React app
    • Failed Transactions & Stuck Payments
    • Contact
  • Quick Payments
    • 🔗Quick Links
      • âœĻGetting Started
      • ðŸĪSharing Quick Links
      • 🚧Errors
    • Invocie
Powered by GitBook
On this page
  • Introduction
  • Step 1: Generate an API Key
  • Step 2: Creating a Payment Request
  • Step 3: Redirecting the User
  • Step 4: Handling Payment Status Updates
  • Sample Integration
  • Conclusion
  1. Resmic Pro

Payment Integration

PreviousAPI Authentications & SecurityNextOrder Status

Last updated 1 month ago

Introduction

Integrating Resmic Pro into your application allows you to accept crypto payments seamlessly. This section provides a step-by-step guide on how to set up payment processing.

Step 1: Generate an API Key

Before initiating payments, ensure you have generated an API key. Refer to the section for details on obtaining your API key.

Step 2: Creating a Payment Request

To create a payment request, send a POST request to the Resmic Pro API:

Request Example

curl --location 'https://api.resmic.com/api/v1/makepayment' \
--header 'Content-type: application/json' \
--header 'x-api-key: <Your_API_KEY>' \
--header 'x-user-id: <Your_User_Id>' \
--data-raw '{
    "amount":100, 
    "blockchain":["Ethereum", "Polygon","BNB-Chain", "Sepolia"], 
    "token": ["USDT", "USDC", "DAI", "ETH", "PUSH"], 
    "title":"Test title for the session", 
    "description": "This is a detailed description for the payment", 
    "wallet_address": "0x056397760b973BfB921Bc10Be9DA5034B1e921d7", 
    "blockchain_confirmation": 1,
    "redirect_url": "localhost:3000/success-page", 
    "cancel_url":"localhost:3000/payment-failed-page", 
    "webhook_url":"adityakaklij11@gmail.com"
} '

Response Example


{
    "status":200,
    "success":true,
    "message":"Sessions created successfully",
    "data":{
        "session_id":"bb0425fe-19b0-4a08-89ce-3dc7f2b53711",
        "payment_url":"https://payments.resmic.com/bb0425fe-19b0-4a08-89ce-3dc7f2b53711"
        }
    }

Step 3: Redirecting the User

Once the payment request is created, redirect the user to the payment_url where they can complete the transaction.

Step 4: Handling Payment Status Updates

Resmic Pro will notify your system about payment status changes through webhooks. Ensure you configure your webhook endpoint in the dashboard.

Webhook Example

{
  "payment_id": "abc123xyz",
  "status": "confirmed",
  "amount": 100,
  "currency": "USDT"
}

Sample Integration


const makePaymentRedirect = async() => {
        try {
            const paymentDetails = {
                amount: 100, // Amount in USD $
                blockchain: ["Ethereum", "Polygon", "BNB-Chain","Sepolia"],
                token: ["USDT", "USDC", "ETH", "DAI"],
                title: "Test title for the session",
                description: "This is a detailed description for the payment",
                wallet_address: "0x056397760b973BfB921Bc10Be9DA5034B1e921d7",
                blockchain_confirmation: 2,
                redirect_url:"https://domain.com/success",
                cancel_url:"https://domain.com/failed",
                webhook_url: "https://webhook-post-endpoint", // Provide webhook endpoint or use email for status updates
            }
            // Initiate the payment session.
            let response = await axios.post(`https://api.resmic.com/api/v1/makepayment`, paymentDetails, {
                headers: {
                    'Content-Type': 'application/json',
                    'x-api-key': 'API_KEY', // Add the API_KEY here
                    'x-user-id': 'USER_ID' // Add the user_id here.
                }
            })
            // Redirection to Payment Page.
            if (response.data?.success){
                let payment_url = response.data?.data?.payment_url
                window.location.assign(payment_url)
            }
            else{
                alert("Unable to generate payment session.")
            }
        } catch (error) {
            console.log("Error: ", error);
        }
    }

Conclusion

By following these steps, you can successfully integrate Resmic Pro for accepting crypto payments. For further customisation, refer to the section.

API Authentication & Security
Webhooks & Notifications