UNPKG

2.13 kBTypeScriptView Raw
1/**
2 * @link https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.wlOhAE&treeId=193&articleId=105465&docType=1
3 *
4 * All values need be urlencoded.
5 */
6export interface AlipayOrder {
7 /**
8 * appId assigned by Alipay
9 */
10 app_id: string;
11 /**
12 * Api name.
13 * Should be: alipay.trade.app.pay
14 */
15 method: string;
16 /**
17 * Data format
18 * Default: "JSON"
19 */
20 format?: string;
21 /**
22 * Charset
23 * Possible values: "UTF-8", "GBK"
24 * Default: "UTF-8"
25 */
26 charset: string;
27 /**
28 * Sign method
29 * Default: 'RSA'
30 */
31 sign_type: string;
32 /**
33 * Sign value. Should be got from server side.
34 * Default: 'RSA'
35 */
36 sign: string;
37 /**
38 * Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
39 */
40 timestamp: string;
41 /**
42 * Api version. Fixed value '1.0'
43 */
44 version: string;
45 /**
46 * Notify url.
47 */
48 notify_url: string;
49 /**
50 * biz content. formated in json. see alipay doc for detail.
51 */
52 biz_content: string;
53}
54/**
55 * @name Alipay
56 * @description
57 * This plugin is used for Alipay APP support. Integrated with the latest SDK.
58 *
59 * Requires Cordova plugin: `cordova-alipay-base`. For more info, please see the [Alipay plugin docs](https://github.com/xueron/cordova-alipay-base).
60 *
61 * @usage
62 * ```
63 * import { Alipay } from 'ionic-native';
64 *
65 * // Should get from server side with sign.
66 * let alipayOrder = {
67 ...
68 * };
69 *
70 * Alipay.pay(alipayOrder)
71 * .then(result => {
72 * console.log(result); // Success
73 * })
74 * .catch(error => {
75 * console.log(error); // Failed
76 * });
77 *
78 * ```
79 *
80 * @interfaces
81 * AlipayOrder
82 */
83export declare class Alipay {
84 /**
85 * Open Alipay to perform App pay
86 * @param order { AlipayOrder } alipay options
87 * @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
88 */
89 static pay(order: AlipayOrder): Promise<any>;
90}