Skip to content

makecryptoio/makepay-unity

Repository files navigation

MakePay Unity

Unity Package Manager helpers for MakePay checkout flows in games, interactive apps, and digital goods experiences.

This package is intentionally client-safe. It opens checkout URLs, parses return/deep-link URLs, and calls your own backend to create checkout sessions. MakePay credentials and webhook verification stay on your server.

Install

In Unity, open Window > Package Manager > Add package from git URL and use:

https://github.com/makecryptoio/makepay-unity.git

The package name is io.makepay.unity.

Flow

  1. Unity sends cart/order/player context to your backend.
  2. Your backend creates a MakePay checkout link and returns JSON.
  3. Unity opens the checkout URL with Application.OpenURL.
  4. MakePay redirects back to your configured deep link.
  5. Unity parses the return URL for UI state only.
  6. Your backend grants durable entitlements after receiving and verifying the MakePay webhook.
sequenceDiagram
    participant Unity
    participant Backend as Game backend
    participant MakePay

    Unity->>Backend: POST /checkout
    Backend->>MakePay: Create checkout
    MakePay-->>Backend: checkoutUrl
    Backend-->>Unity: checkoutUrl
    Unity->>MakePay: Open checkout URL
    MakePay-->>Unity: Deep-link return
    MakePay-->>Backend: Webhook confirmation
    Backend-->>Unity: Entitlement available
Loading

Create And Open Checkout

using MakePay.Unity;
using UnityEngine;

public sealed class BuyCredits : MonoBehaviour
{
    public void Buy()
    {
        var request = new MakePayCheckoutSessionRequest
        {
            externalId = "order_123",
            amountMinor = 999,
            currency = "USD",
            description = "Starter credit pack",
            successUrl = MakePayCheckout.BuildReturnUrl("mygame", "makepay/return", "order_123"),
            cancelUrl = MakePayCheckout.BuildReturnUrl("mygame", "makepay/cancel", "order_123")
        };

        StartCoroutine(MakePayBackendClient.CreateCheckoutSession(
            "https://api.example.com/payments/makepay/checkout",
            request,
            response => MakePayCheckout.OpenCheckoutUrl(response.checkoutUrl),
            error => Debug.LogError(error.message)));
    }
}

Your backend should return:

{
  "checkoutUrl": "https://checkout.makepay.io/pay/example",
  "sessionId": "session_123",
  "externalId": "order_123",
  "expiresAt": "2026-05-29T12:00:00Z"
}

Parse Return Links

MakePayCheckoutResult result;
if (MakePayCheckoutResult.TryParse(url, out result) && result.IsPaid)
{
    Debug.Log("Show a pending confirmation state until the backend confirms the webhook.");
}

Security Model

  • Do not ship MakePay credentials in a Unity build.
  • Do not grant durable goods based only on client-side return parameters.
  • Treat MakePayCheckoutResult as a UI signal.
  • Grant ranks, credits, skins, or subscriptions only after your backend verifies a paid webhook and stores the entitlement.
  • Use your backend to map externalId to an authenticated player/order.

Sample

Import the Checkout Button sample from Package Manager. It contains a small MonoBehaviour that posts to a backend checkout endpoint and opens the returned checkout URL.

Development

This repository validates package metadata and safety constraints with:

npm run validate

Unity Editor tests live under Tests/Runtime and can be run from the Unity Test Runner in a Unity 2021.3+ project.

About

Unity Package Manager helpers for MakePay checkout, deep-link returns, and game backend handoffs. Cryptocurrency payment gateway for direct self-custody merchant-wallet settlement, decentralized swaps, and 70+ coin/20+ chain auto-conversion.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors