Giter VIP home page Giter VIP logo

relario-pay-unity-sdk's Introduction

Relario Pay Unity SDK

Installation

Installation of this package requires Unity 2021.3 or higher.

Under Packages/manifest.json, add the following lines, then open the Unity Editor. Note: this will add a scoped registry to your project.

{
  "dependencies": {
    "com.google.external-dependency-manager": "1.2.178"
  },
  "scopedRegistries": [
    {
      "name": "package.openupm.com",
      "url": "https://package.openupm.com",
      "scopes": [
        "com.google.external-dependency-manager"
      ]
    }
  ]
}

Then you need to go to Package Manager (Assets > View in Package Manager) and import via git url.

Build

This SDK works only if the platform selected is Android. In order to build, you need to do a few changes:

  • In player settings:
    • you need to set MinSDK to 24
    • scripting backend to IL2CPP
    • target architecture : ARMv7 and ARM64
  • If android resolver asks to enable auto-import, press NO
    • in case you enabled it, you can disable it by going to Assets -> External Package Dependency -> Android Resolver -> Settings and disable auto-import.

API

Single payment

Pay(int smsCount, string productId, string productName, string customerId, Action<Exception, Transaction> callback)

Example:

    void Start()
    {
        RelarioPay relarioPay = gameObject.AddComponent<RelarioPay>();
        relarioPay.OnPartialPay = transaction => Debug.Log("Partial Pay");
        relarioPay.OnFailedPay = (exception, transaction) => Debug.Log("Failed Pay");
        relarioPay.OnSuccessfulPay = transaction => Debug.Log("Successful Pay");
        relarioPay.Pay(2, "test", "Test", null, (exception, transaction) =>
        {
            Debug.Log("Transaction started");
        });
    }

Subscribe

    void Start()
    {
        RelarioPay relarioPay = gameObject.AddComponent<RelarioPay>();

        SubscriptionOptions options = new SubscriptionOptions(
            productId: "test",
            smsCount: 2,
            productName: "Example Product - Subscription",
            customerId: Guid.NewGuid().ToString(),
            intervalRate: 24,
            timeUnit: TimeUnit.DAYS
        );

        relarioPay.Subscribe(options);
    }

Cancel subscription

    void Start()
    {
        RelarioPay relarioPay = gameObject.AddComponent<RelarioPay>();

        relarioPay.CancelSubscription(productId: "test");
    }

relario-pay-unity-sdk's People

Contributors

ayazhussein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.