Git Product home page Git Product logo

ti.googlepay's Introduction

ti.googlepay

Axway Titanium Hyperloop module for GooglePay

Installation

  1. Enable hyperloop module in tiapp.xml
  2. Copy ti.googlepay.js into app/lib folder.
  3. Add dependency in app/platform/android/gradle.build
    dependencies {
        implementation 'com.google.android.gms:play-services-wallet:18.0.0'
    }
    
  4. (optional) If you want to use Pay with GPay button, copy assets from brand guideline page into app/platform/android/res

Methods

  • createGooglePayButton(options) - returns Ti.UI.View with GooglePay inside.

    • options - any Ti.UI.View properties

      options.layout: googlepay_button, pay_with_googlepay_button

  • createPaymentsClient(options, callback) - returns paymentClient

    • options

      options.enviorment: ENVIRONMENT_TEST, ENVIRONMENT_PROD

      options.theme: THEME_LIGHT, THEME_DARK

    const googlepay = require('ti.googlepay');
    
    const gpay = googlepay.getPaymentsClient({
        environment: "ENVIRONMENT_TEST",
        theme: "THEME_LIGHT"
    });

paymentClient methods:

  • isReadyToPay(options, callback)

    gpay.isReadyToPay({
        allowedPaymentMethods: ['PAYMENT_METHOD_CARD', 'PAYMENT_METHOD_TOKENIZED_CARD']
    }, function(e) {
        if (e.success) {
            //Show GPay button
        }
    });
  • makePayment(options, callback)

    gpay.makePayment({
        apiVersion: 2,
        apiVersionMinor: 0,
        merchantInfo: {
            merchantName: "Example Merchant"
        },
        allowedPaymentMethods: [
            {
                type: "CARD",
                parameters: {
                    allowedAuthMethods: ["PAN_ONLY", "CRYPTOGRAM_3DS"],
                    allowedCardNetworks: ["MASTERCARD", "VISA"]
                },
                tokenizationSpecification: {
                    type: "PAYMENT_GATEWAY",
                    parameters: {
                        gateway: "exmpleGateway",
                        gatewayMerchantId: "exampleGatewayMerchantId"
                    }
                }
            }
        ],
        transactionInfo: {
            totalPriceStatus: "FINAL",
            totalPrice: "12.34",
            currencyCode: "USD"
        }
    }, function(e) {
        if (e.success) {
            console.log(e.result);
        } else {
            alert(e.error);
        }
    });

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.