Alipay

Improve this doc

This plugin is used for Alipay APP support. Integrated with the latest SDK.

Requires Cordova plugin: cordova-alipay-base. For more info, please see the Alipay plugin docs.

Repo: https://github.com/xueron/cordova-alipay-base

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-alipay-base --variable ALI_PID=your_app_id
    $ npm install --save @ionic-native/alipay
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { Alipay, AlipayOrder } from '@ionic-native/alipay';

constructor(private alipay: Alipay) {

// Should get from server side with sign.
const alipayOrder: AlipayOrder = {
      ...
    };


this.alipay.pay(alipayOrder)
   .then(result => {
      console.log(result); // Success
   })
   .catch(error => {
      console.log(error); // Failed
   });

}

Instance Members

pay(order)

Open Alipay to perform App pay

Param Type Details
order AlipayOrder|string

alipay options

Returns: Promise<any> Returns a Promise that resolves with the success return, or rejects with an error.

AlipayOrder

Param Type Details
app_id string

appId assigned by Alipay

method string

Api name. Should be: alipay.trade.app.pay

format string

Data format Default: "JSON"

(optional)
charset string

Charset Possible values: "UTF-8", "GBK" Default: "UTF-8"

sign_type string

Sign method Default: 'RSA'

sign string

Sign value. Should be got from server side. Default: 'RSA'

timestamp string

Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50

version string

Api version. Fixed value '1.0'

notify_url string

Notify url.

biz_content string

biz content. formated in json. see alipay doc for detail.

API

Native

General