# Payment

# 支付宝支付

# 配置依赖

支付宝支付依赖此ohpm包:@uni_modules/uni-payment-alipay@1.0.1

oh-package.json5文件内dependencies字段下添加如下内容:

"@uni_modules/uni-payment-alipay": "1.0.1"

# 注册模块

在uni_modules入口文件index.generated.ets内注册支付宝支付provider。

import { registerUniProvider, uni } from "@dcloudio/uni-app-runtime";
import { UniPaymentAlipayProviderImpl } from "@uni_modules/uni-payment-alipay";

export function initUniModules() {
  initUniExtApi();
}

function initUniExtApi() {
  registerUniProvider("payment", "alipay", new UniPaymentAlipayProviderImpl());
}