diff --git a/src/document/Dockerfile b/src/document/Dockerfile
new file mode 100644
index 000000000..e6a4de344
--- /dev/null
+++ b/src/document/Dockerfile
@@ -0,0 +1,6 @@
+FROM nginx:alpine
+
+COPY openapi/* /usr/share/nginx/html/
+COPY default.conf /etc/nginx/conf.d/
+
+EXPOSE 80
\ No newline at end of file
diff --git a/src/document/default.conf b/src/document/default.conf
new file mode 100644
index 000000000..c8e646dea
--- /dev/null
+++ b/src/document/default.conf
@@ -0,0 +1,13 @@
+server {
+ listen 80;
+ server_name _ default;
+
+ location / {
+ root /usr/share/nginx/html/;
+ index index.html;
+ }
+
+ location =/ {
+ rewrite / /cn/ redirect;
+ }
+}
\ No newline at end of file
diff --git a/src/document/openapi/cn/components_order.yml b/src/document/openapi/cn/components_order.yml
new file mode 100644
index 000000000..ea5149033
--- /dev/null
+++ b/src/document/openapi/cn/components_order.yml
@@ -0,0 +1,420 @@
+
+orderBasic:
+ required:
+ - description
+ - currency
+ - price
+ properties:
+ description:
+ type: string
+ maxLength: 128
+ description: 订单标题(最大长度128字符,超出自动截取)
+ price:
+ type: integer
+ description: 订单金额,单位为货币最小单位,例如100表示AUD1.00
+ currency:
+ type: string
+ enum:
+ - AUD
+ - CNY
+ notify_url:
+ type: string
+ description: 支付通知回调url,详见支付通知api,不填不会推送支付通知。收到通知回调后强烈建议先进行主动查询再进行确认。
+ operator:
+ type: string
+ description: 操作人员标识
+orderWithChannel:
+ allOf:
+ - $ref: '#/orderBasic'
+ - properties:
+ channel:
+ type: string
+ description: 支付渠道,大小写敏感
+ enum:
+ - Alipay
+ - Wechat
+ type: object
+ required:
+ - channel
+cardCustomerParam:
+ type: object
+ properties:
+ name:
+ type: string
+ description: 消费者姓名,不填会取持卡人姓名
+ postcode:
+ type: string
+ example: 2000
+ description: 澳大利亚邮编
+ address:
+ type: string
+ description: 地址,可使用收货地址
+ city:
+ type: string
+ example: Sydney
+ state:
+ type: string
+ example: VIC
+ country:
+ type: string
+ description: 2位国家代码
+ example: AU
+
+cardCustomerInfo:
+ title: 卡信息
+ properties:
+ bank:
+ type: string
+ description: 发卡行,可能拿不到
+ card_type:
+ type: string
+ description: 卡类型
+ example: credit/debit
+ card_alias:
+ type: string
+ description: 截断卡号,包含前6位和后3位
+ example: 424242...242
+ card_scheme:
+ description: 发卡组织
+ type: string
+ example: VISA/MASTER
+ card_country:
+ description: 发卡国家
+ type: string
+ example: AU
+ customer_id:
+ type: string
+ description: 当下单时tokenize=true或customer_id不为空时存在
+orderBasicResponse:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: 执行结果
+ result_code:
+ type: string
+ description: SUCCESS表示创建订单成功,EXISTS表示订单已存在
+ channel:
+ type: string
+ description: 支付渠道
+ partner_code:
+ type: string
+ description: 商户编码
+ full_name:
+ type: string
+ description: 商户注册全名
+ partner_name:
+ type: string
+ description: 商户名称
+ order_id:
+ type: string
+ description: RoyalPay订单ID,同时也是支付渠道订单ID,最终支付成功的订单ID可能不同
+ partner_order_id:
+ type: string
+ description: 商户订单ID
+orderStatus:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: 执行结果
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: |
+ 订单状态
+ - PAYING: 等待支付
+ - CREATE_FAIL: 创建失败
+ - CLOSED: 已关闭
+ - PAY_FAIL: 支付失败
+ - PAY_SUCCESS: 支付成功
+ - PARTIAL_REFUND: 部分退款
+ - FULL_REFUND: 全额退款
+ 如果需要可以用相同订单号再次发起支付单,支付成功或支付中的无法重复发起订单
+ enum:
+ - PAYING
+ - CREATE_FAIL
+ - CLOSED
+ - PAY_FAIL
+ - PAY_SUCCESS
+ - PARTIAL_REFUND
+ - FULL_REFUND
+ order_id:
+ type: string
+ description: RoyalPay订单ID,同时也是支付渠道订单ID,最终支付成功的订单ID可能不同
+ partner_order_id:
+ type: string
+ description: 商户订单ID
+ channel_order_id:
+ type: string
+ description: 渠道方(支付宝、微信)交易流水号
+ total_fee:
+ type: integer
+ description: 订单金额,单位是货币最小面值单位
+ real_fee:
+ type: integer
+ description: 实际支付金额,单位是货币最小面值单位(目前等于订单金额,为卡券预留)
+ currency:
+ type: string
+ description: 币种,通常为AUD
+ rate:
+ type: number
+ description: 交易时使用的汇率,1AUD=?CNY
+ pay_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-mm-dd HH:mm:ss
+ description: 支付时间(yyyy-MM-dd HH:mm:ss,GMT+10)
+ create_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-mm-dd HH:mm:ss
+ description: 订单创建时间(最新订单为准)(yyyy-MM-dd HH:mm:ss,GMT+10)
+ channel:
+ type: string
+ description: 支付渠道
+ customer_info:
+ anyOf:
+ - title: 支付宝用户
+ type: object
+ properties:
+ alipay_user_id:
+ type: string
+ description: 支付宝用户id
+ alipay_account:
+ type: string
+ description: 用户账号
+ - $ref: 'components_order.yml#/cardCustomerInfo'
+refundStatus:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: 执行结果
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: |
+ 退款状态
+ - WAITING: 正在提交
+ - CREATE_FAILED: 提交失败
+ - SUCCESS: 提交成功,等待入账
+ - FAILED: 退款失败
+ - FINISHED: 退款成功,已入账
+ enum:
+ - WATING
+ - CREATE_FAILED
+ - SUCCESS
+ - FAILED
+ - FINISHED
+ refund_id:
+ type: string
+ description: RoyalPay退款单号
+ partner_refund_id:
+ type: string
+ description: 商户提交的退款单号
+ amount:
+ type: integer
+ description: 退款金额,单位是货币最小单位
+ currency:
+ type: string
+ description: 币种
+ example:
+ AUD
+transactionItem:
+ type: object
+ properties:
+ transaction_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyyMMddHHmmss
+ description: 交易时间,格式yyyyMMddHHmmss,GMT+10
+ partner_code:
+ type: string
+ description: 订单关联商户
+ order_id:
+ type: string
+ description: RoyalPay订单ID
+ partner_order_id:
+ type: string
+ description: 商户订单ID
+ channel_order_id:
+ type: string
+ description: 渠道方订单号
+ refund_id:
+ type: string
+ description: RoyalPay退款单号(仅退款或退款失败补正存在)
+ partner_refund_id:
+ type: string
+ description: 商户系统提交退款ID(仅退款或退款失败补正)
+ gateway:
+ type: integer
+ description: |
+ 下单接口
+ - 0: RoyalPay POS机付款码(扫描客户展示的付款码)
+ - 1: RoyalPay POS机聚合支付码(客户扫描POS展示的二维码)
+ - 2: RoyalPay 商户静态码
+ - 3: QRCode 网关
+ - 4: JSAPI 网关
+ - 5: 第三方POS付款码网关
+ - 6: 第三方POS聚合支付码网关
+ - 7: RoyalPay 商户静态码(已停用)
+ - 8: H5网关
+ - 9: WEB网关
+ - 10: SDK订单
+ - 11: RoyalPay账单码
+ - 12: 小程序
+ - 13: 原生二维码订单
+ - 14: RoyalPay账单链接
+ - 15: 原生JSAPI
+ - 16: 卡支付预订单
+ - 17: 卡支付订单
+ - 18: DirectDebit
+ channel:
+ type: string
+ description: 下单渠道
+ type:
+ type: string
+ description: 流水类别
+ enum:
+ - Credit
+ - Debit
+ currency:
+ type: string
+ description: 订单币种
+ example:
+ AUD
+ total_amount:
+ type: integer
+ description: 订单总金额,单位是货币最小单位
+ input_amount:
+ type: integer
+ description: 订单输入金额,单位是货币最小单位
+ customer_payment_amount:
+ type: integer
+ description: 用户实际支付金额,单位是货币最小单位
+ settle_amount:
+ type: integer
+ description: 结算金额,币种为AUD,单位是货币最小单位
+ transfer_amount:
+ type: integer
+ description: 打款金额(结算金额-手续费-GST),币种为AUD,单位是货币最小单位
+ surcharge:
+ type: integer
+ description: 手续费,币种为AUD,单位是货币最小单位
+ gst:
+ type: integer
+ description: GST金额,币种为AUD,单位是货币最小单位
+ exchange_rate:
+ type: number
+ description: 使用汇率
+ remark:
+ type: string
+ description: 备注
+customInfo:
+ type: object
+ properties:
+ report_id:
+ type: string
+ description: RoyalPay海关单号
+ client_report_id:
+ type: string
+ description: 商户申请报关单号
+ report_status:
+ type: string
+ description: 报关单状态
+ enum:
+ - PROCESSING
+ - SUBMITED
+ - FAILED
+ - SUCCESS
+ channel:
+ type: string
+ description: 支付渠道
+ custom:
+ type: string
+ description: 海关编号
+ mch_custom_no:
+ type: string
+ description: 商户在海关备案的编号
+ mch_custom_name:
+ type: string
+ description: 商户海关备案名称
+ order_id:
+ type: string
+ description: RoyalPay订单号
+ transaction_id:
+ type: string
+ description: 支付渠道订单号
+ order_currency:
+ type: string
+ description: 币种
+ order_amount:
+ type: number
+ description: 订单金额
+ report_time:
+ type: string
+ format: 'date-time'
+ description: 报关时间
+ creation_date:
+ format: 'date-time'
+ type: string
+ description: 报关单创建时间
+ last_update_date:
+ type: string
+ format: 'date-time'
+ description: 更新时间
+ error_code:
+ type: string
+ description: 错误代码
+ error_msg:
+ type: string
+ description: 错误返回的信息描述
+ verify_department:
+ type: string
+ description: 验核机构
+ verify_department_trade_id:
+ type: string
+ description: 验核机构交易流水号
+ sub_orders:
+ type: array
+ items:
+ type: object
+ properties:
+ sub_order_no:
+ type: string
+ description: 商户子订单号
+ fee_type:
+ type: string
+ description: 币种代码
+ default: CNY
+ enum:
+ - CNY
+ order_fee:
+ type: number
+ description: 子订单金额
+ transport_fee:
+ type: number
+ description: 子订单物流金额
+ verify_department:
+ type: string
+ description: 验核机构
+ verify_department_trade_id:
+ type: string
+ description: 验核机构交易流水号
+ report_status:
+ type: string
+ description: 报关单状态
+ enum:
+ - PROCESSING
+ - SUBMITED
+ - FAILED
+ - SUCCESS
+ error_code:
+ type: string
+ description: 错误代码
+ error_msg:
+ type: string
+ description: 错误返回的信息描述
\ No newline at end of file
diff --git a/src/document/openapi/cn/document.yml b/src/document/openapi/cn/document.yml
new file mode 100644
index 000000000..317eeb013
--- /dev/null
+++ b/src/document/openapi/cn/document.yml
@@ -0,0 +1,1337 @@
+openapi: 3.0.3
+info:
+ title: RoyalPay Developer Documents
+ version: 1.0.0
+ x-logo:
+ url: img/rp_logo.svg
+ description: |
+ [English](/en/)
+
+ # 请求方式和参数格式
+ 支付单和退款单提交均为PUT方式,订单查询均为GET方式;包含Request Entity的请求参数格式为json
+
+ 除跳转页面外,所有的Accept均为application/json;所有的PUT/POST请求Content-Type为application/json
+
+ 系统使用UTF-8字符集
+
+ 参数分为三种:Path Variable/Query Param/JSON entity
+
+ - PathVariable:包含在URI内的参数
+ - Query Param:在URI末尾?后的key=value形式的参数
+ - JSON entity:只在PUT/POST请求中使用
+ 所有返回JSON的API,成功访问返回状态值均为200(不论执行结果)。JSON固定包含字段return_code,若值为SUCCESS则表示执行成功; 其他值表示执行失败,此时可查询错误码了解对应的错误类型,此时还会携带return_msg字段作为错误描述信息
+
+ # 多语言支持
+
+ 系统错误提示支持中文、英文两种语言,默认根据Request Header中的Accept-Language值自动选择,如需调整亦可以添加locale cookie进行指定。
+
+ # 选择接入API
+
+
+ # 支付宝渠道区分
+
+ 支付宝根据调用接口不同分为线上和线下两个渠道,两个渠道分别使用不同的汇率和手续费费率,为避免混淆在此区分:
+
+ - 线上渠道:包含H5 Mobile、Web支付、APP SDK、JSAPI、QR Code 5种支付方式
+ - 线下渠道:Retail Pay 支付方式
+
+ 相似接口区别
+
+ - JSAPI和H5 Mobile:JSAPI只能在支付宝客户端内访问的页面调起支付,H5可以在移动设备任意浏览器或App的WebView调起支付
+ - Web支付和QR Code: Web支付会跳转到支付宝官方收银台,用户可以选择登陆账号或用客户端扫码完成支付;QR Code方式商户可以自行展示创建的二维码,也可以跳转到RoyalPay展示的收银台页面显示二维码,用户只能用支付宝客户端扫码完成支付。
+
+ # 币种代码
+
+ 由于渠道方限制原因,RoyalPay只接受人民币和澳元两个币种标价的支付订单。其中银行卡支付渠道仅支持AUD下单。无论标价是什么币种最终结算币种为AUD
+
+ - AUD:澳元
+ - CNY:人民币
+
+ 除报关相关API以外,接口中的金额都应该取*币种最小单位*,如人民币和澳元都应该用分作为标价。如AUD 1.00的订单提交的金额参数为100
+
+ # 业务规则
+
+ - QRCode支付是在网页上展示二维码,用户使用微信扫一扫扫码后直接进入微信支付页面,适用于商城类web网站;
+ - JSAPI支付是在微信浏览器内直接跳转到RoyalPay让用户选择支付订单,页面只能在微信客户端打开,适用于微店;
+ - 创建订单时需要提供订单号,同一个订单允许重复提交,系统会自动根据订单状态判断是否创建新订单并关闭旧订单。因此商户端应该同一个订单只用一个单号,避免重复付款;
+ - 由于存在自动创建新订单机制,创建订单后返回的RoyalPay单号不代表最终支付的单号;
+ - QRCode支付订单创建后会直接返回QRCode和pay_url,商户可以自行选择展示支付二维码或跳转至RoyalPay支付页;
+ - JSAPI支付订单创建后会返回pay_url,商户应该跳转到这个地址让用户完成支付;
+ - 跳转pay_url时必须加上签名信息;
+ - 每次请求都应该生成新的签名;
+ - 订单成功支付后会调用订单中提供的notify_url,详情可以查看API定义;若创建订单时未提供,商户需要在创建订单后轮询订单状态接口,直到订单被支付或过期;
+ - 订单支付有效期为5分钟,超时可以用相同的订单号重新发起请求,建议重新发起请求的时机为用户再次打开支付页的时候;
+ - 使用跳转支付页前应该先调用后台服务输入金额等参数创建订单后再跳转;
+ - 创建订单、创建退款接口都允许同订单号重复调用,但是具体参数以初次请求的参数为准;
+ - 所有和金额相关的数字均以货币最小面值为单位,以AUD为例,100表示AUD 1.00。
+
+ # 案例
+ https://example.royalpay.com.au/api/payment/order
+
+
+
+ # 示例代码
+ - PHP: https://mpay.royalpay.com.au/static/phpdemo.zip
+ - Java: https://mpay.royalpay.com.au/static/javademo.zip
+
+ # 错误码参考
+ ## 通用错误码
+ - SYSTEMERROR: 系统内部异常
+ - INVALID_SHORT_ID: 商户编码不合法或没有对应商户
+ - SIGN_TIMEOUT: 签名超时,time字段与服务器时间相差超过5分钟
+ - SIGN_EXPIRED: 签名失效,签名被重复使用
+ - INVALID_SIGN: 签名错误
+ - PARAM_INVALID: 参数不符合要求,具体细节可参考return_msg字段
+
+ ## 下单错误码
+ - NOT_PERMITTED: 未开通网关支付权限
+ - INVALID_CHANNEL: 不合法的支付渠道名称,请检查大小写
+ - ORDER_MISMATCH: 订单号与商户不匹配
+ - AUTHCODEEXPIRE: 二维码已过期
+ - NOTSUPORTCARD: 不支持卡类型
+ - AUTH_CODE_ERROR: 二维码被重复提交
+ - AUTH_CODE_INVALID: 非法二维码
+ - NOTENOUGH: 账户余额不足
+ - ORDER_PAID: 订单已支付
+
+servers:
+ - url: https://mpay.royalpay.com.au/api/v1.0
+ description: production
+ - url: https://sandbox.royalpay.com.au/api/v1.0
+ description: sandbox
+tags:
+ - name: PublicApi
+ description: 公共API
+ - name: QRCode
+ description: |
+ QRCode支付单适用于PC端网页/应用进行支付,用户使用微信/支付宝客户端扫描下单后生成的二维码完成支付。
+
+ 返回值包括二维码字符串,二维码图片,支付地址,商户可以自行决定直接展示二维码或跳转支付页,跳转支付页需要带上签名信息。 货币类型如果是CNY,注意通过汇率转换后不得低于0.01AUD,否则订单可以创建成功,但支付时会报金额不合法错误
+ - name: JSAPI
+ description: |
+ JSAPI适用于在微信/支付宝内打开的网页进行支付,如果用户从微信公众号进入支付页要求公众号已完成认证。用户下单后跳转至RoyalPay订单页,并拉起微信或支付宝内置收银台完成支付
+
+ 返回值包括支付地址,商户应该引导用户跳转支付页,跳转支付页需要带上签名信息; 货币类型如果是CNY,注意通过汇率转换后不得低于0.01AUD,否则订单可以创建成功,但支付时会报金额不合法错误
+ - name: MobileH5
+ description: |
+ 创建H5支付单(仅支持支付宝)
+ H5支付适用场景为移动端App或者手机自带浏览器进行支付,用户下单后浏览器跳转至微信支付页面并自动拉起支付宝客户端完成支付。
+ 返回值包括跳转支付地址,跳转支付页需要带上签名信息。 货币类型如果是CNY,注意通过汇率转换后不得低于0.01AUD,否则订单可以创建成功,但支付时会报金额不合法错误
+
+ - name: MiniProgram
+ description: |
+ 接入微信小程序需完成海外主体认证,并且认证主体需要与在RoyalPay开通的商户主体一致。具体如何认证请查看微信公众平台相关文档。
+ 用于小程序中发起支付,创建订单后返回小程序支付所需参数,[微信接入参考文档](https://www.royalpay.com.au/downloads/MiniProgram_WechatPay.pdf)
+
+ - name: CardPayment
+ description: |
+ 卡支付即消费者输入银行卡信息进行下单的接口,接入卡支付需要额外的合规流程。
+ - name: RetailPay
+ description: |
+ 线下支付订单接口用于线下零售收银,有B扫C和C扫B两种模式
+ - name: AlipayOnline
+ description: |
+ 用于PC端支付宝支付,创建订单后跳转到返回的pay_url(需附加签名参数和redirect参数),随后进入支付宝支付页面完成支付
+ 该接口现仅支持支付宝。
+
+ - name: CB Bank
+ description: |
+ 用于PC端网银快捷支付,创建订单后跳转到返回的pay_url,随后进入网银快捷支付页面完成支付
+ - name: SDK Payment
+ description: |
+ 用于移动端APP调用微信/支付宝SDK支付,调用API创建订单,得到微信SDK调用参数,将参数传递给SDK拉起微信/支付宝支付,并由客户端直接返回支付结果。 强烈建议获得支付结果后再调用RoyalPay订单查询API确认完成支付后再进行后续流程,避免因超时自动撤单导致资金损失
+
+ 关于客户端和支付宝整和的更多信息:[支付宝SDK文档](https://global.alipay.com/doc/app_cn/about)
+ 关于客户端和微信整合的更多信息:[微信SDK文档](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1)
+ [Alipay SDK for Android](resources/api/alipaySdk-20160825.jar)
+ [Alipay SDK for iOS](resources/api/AlipaySDKForiOS.zip)
+ [Wechat SDK for Android](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN)
+ [Wechat SDK for iOS](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN)
+
+ - name: Custom
+ description: 用于商户提交海关需要的订单附件信息。仅支持微信和支付宝,微信只支持一个月内的支付订单进行报关申请。
+security:
+ - sign: []
+ nonce_str: []
+ time: []
+paths:
+ /gateway/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ tags:
+ - QRCode
+ summary: 创建QRCode支付单
+ x-sort-order: 0
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: 商户编码,由4位大写字母或数字构成
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 商户支付订单号,要求同一商户唯一
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderWithChannel'
+ responses:
+ 200:
+ description: 执行结果
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ code_url:
+ type: string
+ description: 支付码字符串,商户可以据此自行生产二维码
+ qrcode_img:
+ type: string
+ description: Base64封装的二维码图片,可直接作为img的src属性
+ pay_url:
+ type: string
+ description: 收银台URL,如果商户选择跳转到royalpay的QR收银台可使用此url
+ get:
+ summary: 查询订单状态
+ x-sort-order: 9
+ tags:
+ - SDK Payment
+ - CB Bank
+ - RetailPay
+ - AlipayOnline
+ - CardPayment
+ - MiniProgram
+ - MobileH5
+ - JSAPI
+ - QRCode
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ responses:
+ 200:
+ description: Order Status
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderStatus'
+ delete:
+ summary: 关闭订单
+ x-sort-order: 10
+ tags:
+ - SDK Payment
+ - CB Bank
+ - RetailPay
+ - AlipayOnline
+ - CardPayment
+ - MiniProgram
+ - MobileH5
+ - JSAPI
+ - QRCode
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ responses:
+ 200:
+ description: Order Status
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderStatus'
+ /gateway/partners/{partner_code}/native_orders/{partner_order_id}:
+ put:
+ tags:
+ - QRCode
+ summary: 创建原生QRCode支付单
+ description: |
+ 原生二维码支付单展示的是直接由微信、支付宝生成的收款码,扫码后直接在APP内加载,对于消费者网络环境不佳的场景具有一定帮助
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: 商户编码,由4位大写字母或数字构成
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 商户支付订单号,要求同一商户唯一
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderWithChannel'
+ responses:
+ 200:
+ description: 执行结果
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ code_url:
+ type: string
+ description: 支付码字符串,商户可以据此自行生产二维码
+ qrcode_img:
+ type: string
+ description: Base64封装的二维码图片,可直接作为img的src属性
+ pay_url:
+ type: string
+ description: 收银台URL,如果商户选择跳转到royalpay的QR收银台可使用此url
+ /gateway/partners/{partner_code}/orders/{partner_order_id}/pay:
+ get:
+ tags:
+ - QRCode
+ summary: QRCode支付页
+ x-sort-order: 2
+ description: 必须先调用创建QRCode订单接口再进行跳转。 建议在用户回调到对应页时通过后台查询订单状态接口确认订单的支付状态。
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: 商户编码,由4位大写字母或数字构成
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 商户支付订单号,要求同一商户唯一
+ - name: redirect
+ required: true
+ in: query
+ description: 支付成功后跳转页面,回调时会带上签名参数用于校验
+ responses:
+ 200:
+ description: 支付页面
+ content:
+ text/html:
+ schema:
+ type: string
+ /jsapi_gateway/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 创建JSAPI订单
+ description: 创建JSAPI订单
+ x-sort-order: 0
+ tags:
+ - JSAPI
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: 商户编码,由4位大写字母或数字构成
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 商户支付订单号,要求同一商户唯一
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderWithChannel'
+ responses:
+ 200:
+ description: 执行结果
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /wechat_jsapi_gateway/partners/{partner_code}_order_{partner_order_id}:
+ get:
+ summary: 微信JSAPI支付跳转页
+ description: 微信JSAPI支付跳转页,建议优先使用下单返回的pay_url字段
+ x-sort-order: 2
+ tags:
+ - JSAPI
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ - name: redirect
+ in: query
+ description: 支付完成回调,注意转义
+ - name: directpay
+ in: query
+ description: 是否进入页面后直接发起支付
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: 微信JSAPI支付跳转页
+ content:
+ text/html:
+ schema:
+ type: string
+ /gateway/alipay/partners/{partner_code}/orders/{partner_order_id}/app_pay:
+ get:
+ summary: 支付宝JSAPI支付跳转页
+ description: 支付宝JSAPI支付跳转页,建议优先使用下单返回的pay_url字段
+ x-sort-order: 2
+ tags:
+ - JSAPI
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ - name: redirect
+ in: query
+ description: 支付完成回调,注意转义
+ - name: directpay
+ in: query
+ description: 是否进入页面后直接发起支付
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: 支付宝JSAPI支付跳转页
+ content:
+ text/html:
+ schema:
+ type: string
+ /h5_payment/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: MobileH5下单
+ description: 仅支持支付宝接口
+ x-sort-order: 0
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ tags:
+ - MobileH5
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ properties:
+ channel:
+ type: string
+ description: 支付渠道,大小写敏感
+ enum:
+ - Alipay
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ type: object
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /h5_payment/partners/{partner_code}/orders/{partner_order_id}/pay:
+ get:
+ summary: H5支付跳转页
+ description: H5支付跳转页,建议优先使用下单返回的pay_url字段
+ x-sort-order: 2
+ tags:
+ - MobileH5
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ - name: redirect
+ in: query
+ description: 支付完成回调,注意转义
+ responses:
+ 200:
+ description: H5支付跳转页
+ content:
+ text/html:
+ schema:
+ type: string
+ /gateway/partners/{partner_code}/microapp_orders/{partner_order_id}:
+ put:
+ summary: 小程序下单
+ x-sort-order: 0
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ tags:
+ - MiniProgram
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderWithChannel'
+ - type: object
+ properties:
+ appid:
+ type: string
+ description: 小程序appid,接入微信小程序必填,支付宝小程序不需要
+ customer_id:
+ type: string
+ description: 小程序获取的用户id(微信为openid, 支付宝为userid)
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ sdk_params:
+ type: string
+ description: 序列化后的json字符串,直接提交给小程序端作为参数发起支付
+ /gateway/partners/{partner_code}/pre_card_orders/{partner_order_id}:
+ put:
+ summary: 卡支付预定单
+ x-sort-order: 1
+ description: |
+ 预订单模式是先提交基础下单参数,然后跳转到royalpay网关页让消费者完成卡信息提交并完成支付。
+ 卡支付预订单允许消费者多次尝试输入,因此除非主动关闭订单,订单会一直持续到有效期结束。
+ tags:
+ - CardPayment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ properties:
+ domestic_only:
+ type: boolean
+ default: false
+ description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。
+ disable_credit_card:
+ type: boolean
+ default: false
+ description: 如果希望禁止消费者使用信用卡支付可传入true
+ tokenize:
+ type: boolean
+ default: false
+ description: 支付成功后是否返回消费者ID,此后下单可以提供customer_id免去消费者输入卡号、有效期等步骤,仅需要输入CVV2/CVC码。
+ customer_id:
+ type: string
+ description: 使用tokenize得到的customer_id下单,当customer_id不为空时,tokenize参数无效,可免去消费者输入卡号、有效期等步骤,仅需要输入CVV2/CVC码。
+ customer:
+ $ref: 'components_order.yml#/cardCustomerParam'
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /card_payment_view/partners/{partner_code}/orders/{partner_order_id}/view:
+ get:
+ summary: 卡支付收银台
+ description: 建议以下单返回的pay_url为准
+ x-sort-order: 2
+ tags:
+ - CardPayment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ - name: redirect
+ in: query
+ description: 支付完成同步回调,注意转义
+ responses:
+ 200:
+ description: 支付跳转页
+ content:
+ text/html:
+ schema:
+ type: string
+ /gateway/partners/{partner_code}/card_orders/{partner_order_id}:
+ put:
+ summary: 卡支付下单
+ x-sort-order: 0
+ description: |
+ 商户可在页面引入https://channel.rpayplus.com/channel/v1/view/card_input_frame.js
+ 并通过回调取得key_id和secret信息,并将其作为卡信息提交给royalpay直接完成下单支付。
+
+ js引用案例:
+ ```
+ let cardInputContainer = document.getElementById('card-input-area');//预先准备放置卡输入界面的container
+ let cardInput = new CardInputFrame(cardInputContainer);//创建frame对象
+ //设置iframe的样式参数
+ cardInput.frameStyle = {
+ width: '100%',
+ height: '400px',
+ border: 'none',
+ borderRadius: '10px'
+ };
+ cardInput.onError = function(msg){
+ //卡输入界面返回错误信息时进行展示
+ };
+ cardInput.onReady = function(){
+ //iframe加载完毕的触发事件
+ };
+ cardInput.onSuccess = function(secretData){
+ //成功取得加密卡信息回调
+ //secretData: {'key_id':'','secret':''}
+ };
+ cardInput.show();//开始加载iframe
+
+ //通过外部事件触发卡输入界面提交,注意卡输入界面没有按钮,必须通过外部触发提交事件。并回调到onSuccess回调函数。
+ cardInput.commit();
+ ```
+ tags:
+ - CardPayment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - key_id
+ - card_info
+ properties:
+ key_id:
+ type: string
+ description: 卡输入界面回调得到的key_id
+ card_info:
+ type: string
+ description: 卡输入界面回调得到的secret
+ domestic_only:
+ type: boolean
+ default: false
+ description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。
+ disable_credit_card:
+ type: boolean
+ default: false
+ description: 如果希望禁止消费者使用信用卡支付可传入true
+ customer:
+ $ref: 'components_order.yml#/cardCustomerParam'
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderBasicResponse'
+ /micropay/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 付款码下单
+ x-sort-order: 0
+ description: |
+ 线下支付订单接口用于带有扫码设备的收银终端进行对接,商户输入金额后要求客户出示支付码,用扫码枪扫码后将扫码内容和金额一并提交并完成支付操作。
+ 线下支付订单接口现已兼容微信、支付宝通道。可根据付款码自动识别交易渠道。
+
+ tags:
+ - RetailPay
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - auth_code
+ - device_id
+ properties:
+ device_id:
+ type: string
+ description: 扫码设备id
+ auth_code:
+ type: string
+ description: 付款码
+ responses:
+ 200:
+ description: Result
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderStatus'
+ /retail_qrcode/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 线下QRCode支付单
+ x-sort-order: 1
+ description: |
+ 线下QRCode支付用于对接无扫码设备的收银终端,下单后得到二维码地址,自行生成二维码图片后展示在收银终端屏幕上,并由用户使用对应支付客户端进行扫码支付。 线下QRCode现已同时兼容支付宝、微信客户端进行支付
+
+ tags:
+ - RetailPay
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - device_id
+ properties:
+ device_id:
+ type: string
+ description: 收银设备id
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ code_url:
+ type: string
+ description: 付款码字符串,商户可自行生成二维码 # todo
+ /alipay/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 支付宝WEB订单下单
+ x-sort-order: 0
+ description: |
+ 创建订单后跳转到返回的pay_url(需附加签名参数和redirect参数),随后进入支付宝支付页面完成支付
+ 该接口现仅支持支付宝。
+ tags:
+ - AlipayOnline
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderBasic'
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /cb_bankpay/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 网银快捷支付下单
+ x-sort-order: 0
+ tags:
+ - CB Bank
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - product_name
+ - gateway_type
+ properties:
+ product_name:
+ type: string
+ description: 商品名称
+ gateway_type:
+ type: integer
+ description: '网关类型,8: H5网关,9:PC网关'
+ enum:
+ - 8
+ - 9
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /gateway/partners/{partner_code}/app_orders/{partner_order_id}:
+ put:
+ summary: SDK下单
+ x-sort-order: 0
+ tags:
+ - SDK Payment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - channel
+ properties:
+ channel:
+ type: string
+ description: 支付渠道,大小写敏感
+ enum:
+ - Wechat
+ - Alipay
+ system:
+ type: string
+ description: 客户端操作类型,支付宝选填,微信不需要
+ enum:
+ - android
+ - iphone
+ - ipad
+ version:
+ type: string
+ description: 客户端版本号,支付宝选填,微信不需要
+ appid:
+ type: string
+ description: 微信必填,开发者平台appid
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ sdk_params:
+ type: string
+ description: json字符串,可直接传递给SDK端发起支付
+ /gateway/partners/{partner_code}/channel_exchange_rate:
+ get:
+ summary: 渠道汇率查询
+ description: 获取当前各渠道AUD兑CNY汇率值(1AUD=?CNY),该汇率仅做参考,以实际成交汇率为准
+ tags:
+ - PublicApi
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ responses:
+ 200:
+ description: exchange rate
+ content:
+ application/json:
+ schema:
+ type: object
+ description: OK
+ properties:
+ return_code:
+ type: string
+ description: 状态码
+ example:
+ SUCCESS
+ wechat_rate:
+ type: number
+ description: 微信当前汇率
+ example:
+ 4.41111
+ alipay_retail_rate:
+ type: number
+ description: 支付宝线下接口汇率
+ example:
+ 4.411111
+ alipay_online_rate:
+ type: number
+ description: 支付宝线上汇率
+ example:
+ 4.411111
+ /gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}:
+ put:
+ summary: 发起退款
+ x-sort-order: 11
+ description: 一笔支付订单可以分多次退款,退款总金额不得超过实际支付金额,退款币种与支付订单一致
+ tags:
+ - QRCode
+ - JSAPI
+ - MobileH5
+ - MiniProgram
+ - CardPayment
+ - AlipayOnline
+ - RetailPay
+ - CB Bank
+ - SDK Payment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 需要退款订单的单号
+ - name: partner_refund_id
+ in: path
+ required: true
+ description: 退款单号
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - fee
+ properties:
+ fee:
+ type: integer
+ description: 退款金额,单位是货币最小单位,单个订单退款单金额总和不能超过用户支付金额
+ device_id:
+ type: string
+ description: 操作设备id
+ responses:
+ 200:
+ description: Refund
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/refundStatus'
+ get:
+ summary: 查询退款
+ x-sort-order: 12
+ tags:
+ - QRCode
+ - JSAPI
+ - MobileH5
+ - MiniProgram
+ - CardPayment
+ - AlipayOnline
+ - RetailPay
+ - CB Bank
+ - SDK Payment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 需要退款订单的单号
+ - name: partner_refund_id
+ in: path
+ required: true
+ description: 退款单号
+ responses:
+ 200:
+ description: Refund Status
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/refundStatus'
+ /gateway/partners/{partner_code}/transactions:
+ get:
+ summary: 查询流水
+ description: |
+ 本接口将列出商户当日所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等,不含清算信息
+ 注意一笔付款订单或退款订单均可能对应多条流水记录
+ tags:
+ - PublicApi
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: date
+ schema:
+ format: date
+ pattern: yyyyMMdd
+ type: string
+ in: query
+ required: true
+ description: 账单日期,'yyyyMMdd'格式,GMT+10,只能查今天以前的账单
+ example: 20200315
+ responses:
+ 200:
+ description: Orders
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: 执行结果
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: 业务执行结果
+ example:
+ SUCCESS
+ transaction_count:
+ type: integer
+ description: 流水条数
+ order_count:
+ type: integer
+ description: 付款条数
+ refund_count:
+ type: integer
+ description: 退款条数
+ transactions:
+ type: array
+ items:
+ $ref: 'components_order.yml#/transactionItem'
+ /gateway/partners/{partner_code}/settlements:
+ get:
+ summary: 查看清算详情
+ description: |
+ 本接口将列出商户查询日期清算的所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等
+ 注意一笔付款订单或退款订单均可能对应多条流水记录
+ tags:
+ - PublicApi
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: date
+ in: query
+ schema:
+ format: date
+ pattern: yyyyMMdd
+ type: string
+ description: 清算日期,'yyyyMMdd'格式,GMT+10,只能查今天以前
+ required: true
+ responses:
+ 200:
+ description: Settlements
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: 执行结果
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: 业务执行结果
+ example:
+ SUCCESS
+ settle_from:
+ type: string
+ format: date
+ description: 订单起始日期:yyyyMMdd
+ settle_to:
+ type: string
+ format: date
+ description: 订单截止日期:yyyyMMdd
+ settle_days:
+ type: string
+ description: 清算周期
+ example:
+ T+2
+ transaction_count:
+ type: integer
+ description: 流水条数
+ order_count:
+ type: integer
+ description: 付款条数
+ refund_count:
+ type: integer
+ description: 退款条数
+ total_credit:
+ type: integer
+ description: 入账总金额(AUD分)
+ total_debits:
+ type: integer
+ description: 支出总金额(AUD分)
+ total_surcharge:
+ type: integer
+ description: 手续费总额(AUD分)
+ total_transfer:
+ type: integer
+ description: 打款总额(AUD分)
+ transactions:
+ type: array
+ items:
+ $ref: 'components_order.yml#/transactionItem'
+ /notify:
+ post:
+ summary: 到账通知
+ description: |
+ 若订单创建时提供了notify_url,系统会在用户支付成功后向这个地址主动发送支付成功状态推送,请求方式为POST
+ 与服务器API不同,推送校验参数会包含在json内,商户系统应该验证校验参数,确定来源正确后再次进行订单接口查询确认订单支付状态再进行后续操作。
+ 商户系统收到请求后应按要求返回参数,若RoyalPay未收到合法参数,视为商户未接收成功,推送动作首次触发会重试3次,随后24小时内每10分钟推送一次,直到返回200状态码。
+ 商户系统应当能够处理收到的重复请求。
+ 商户系统收到通知后以防万一应调用主动查询接口确认订单状态。
+ tags:
+ - SDK Payment
+ - CB Bank
+ - RetailPay
+ - AlipayOnline
+ - CardPayment
+ - MiniProgram
+ - MobileH5
+ - JSAPI
+ - QRCode
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ time:
+ type: integer
+ format: int64
+ description: UTC时间戳
+ nonce_str:
+ type: string
+ description: 随机字符串
+ sign:
+ type: string
+ description: 签名
+ partner_order_id:
+ type: string
+ description: 商户单号
+ channel_order_id:
+ type: string
+ description: 渠道方交易单号
+ order_id:
+ type: string
+ description: RoyalPay订单号
+ total_fee:
+ type: integer
+ description: 订单金额,单位是最小货币单位
+ real_fee:
+ type: integer
+ description: 支付金额,单位是最小货币单位
+ rate:
+ type: number
+ description: 交易时使用的汇率,1AUD=?CNY
+ currency:
+ type: string
+ description: 币种,AUD
+ channel:
+ type: string
+ description: 交易渠道
+ create_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-MM-dd HH:mm:ss
+ description: 订单创建时间,格式为'yyyy-MM-dd HH:mm:ss',GMT+10
+ pay_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-MM-dd HH:mm:ss
+ description: 订单支付时间,格式为'yyyy-MM-dd HH:mm:ss',GMT+10
+ responses:
+ 200:
+ description: OK
+ /customs/partners/{partner_code}/declare/report/{client_report_id}:
+ put:
+ summary: 创建报关单
+ tags:
+ - Custom
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: client_report_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ order_id:
+ type: string
+ description: 商户支付订单号,要求同一商户唯一
+ custom:
+ type: string
+ description: 海关编号 * [渠道海关编号](https://www.royalpay.com.au/downloads/CustomsNO.xlsx)
+ mch_custom_id:
+ type: string
+ description: 商户在海关备案的编号
+ mch_custom_name:
+ type: string
+ description: 商户海关备案名称
+ sub_order:
+ type: array
+ description: 子订单(拆单)
+ items:
+ type: object
+ properties:
+ sub_order_no:
+ type: string
+ description: 商户子订单号
+ fee_type:
+ type: string
+ description: 币种代码
+ default: CNY
+ enum:
+ - CNY
+ order_fee:
+ type: number
+ description: 子订单金额,单位是元
+ transport_fee:
+ type: number
+ description: 子订单物流金额,单位是元
+ responses:
+ 200:
+ description: Custom
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/customInfo'
+ get:
+ summary: 查询报关单
+ tags:
+ - Custom
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: client_report_id
+ in: path
+ required: true
+ responses:
+ 200:
+ description: Custom
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/customInfo'
+ /customs/partners/{partner_code}/redeclare/report/{client_report_id}:
+ put:
+ summary: 重新提交报关单
+ description: 用于重新提交未报关成功的报关单
+ tags:
+ - Custom
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: client_report_id
+ in: path
+ required: true
+ responses:
+ 200:
+ description: Custom
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/customInfo'
+components:
+ securitySchemes:
+ nonce_str:
+ type: apiKey
+ in: query
+ name: nonce_str
+ description: 随机字符串
+ time:
+ type: apiKey
+ in: query
+ name: time
+ description: 带毫秒的Unix时间戳,务必检查服务器时间和时区配置。计算服务器上的UTC时间是否匹配真实UTC时间即可。允许误差±5分钟
+ sign:
+ type: apiKey
+ in: query
+ name: sign
+ description: |
+ 商户签约后会分配得到一个partner_code和credential_code用于签名,其中partner_code随请求传递,credential_code务必自行存储不得外泄,仅作为签名参数。
+
+ 每次请求都必须加入签名信息作为请求校验。校验参数全部以Query Param参数的方式附加在URL后面,顺序不分先后。
+
+ 签名过程:
+
+ 1. 连接生成签名的原始字符串,需要4个参数,使用&连接,无需转码
+ > valid_string=partner_code&time&nonce_str&credential_code
+
+ 2. 使用SHA256对valid_string进行签名,并转换为小写字符串
+ > sign=hex(sha256(valid_string)).toLowerCase()
+
+ 3. 在请求中将签名使用的time, nonce_str和生成的sign作为query参数发送
+
+ > 签名测试地址:https://mpay.royalpay.com.au/sign_test.html
+
+
diff --git a/src/document/tpl/img/JSAPI_process_cn.png b/src/document/openapi/cn/img/JSAPI_process_cn.png
similarity index 100%
rename from src/document/tpl/img/JSAPI_process_cn.png
rename to src/document/openapi/cn/img/JSAPI_process_cn.png
diff --git a/src/document/tpl/img/QRCODE_process_ch.png b/src/document/openapi/cn/img/QRCODE_process_ch.png
similarity index 100%
rename from src/document/tpl/img/QRCODE_process_ch.png
rename to src/document/openapi/cn/img/QRCODE_process_ch.png
diff --git a/src/document/tpl/img/RetailQR_cn.png b/src/document/openapi/cn/img/RetailQR_cn.png
similarity index 100%
rename from src/document/tpl/img/RetailQR_cn.png
rename to src/document/openapi/cn/img/RetailQR_cn.png
diff --git a/src/document/tpl/img/Retail_cn.png b/src/document/openapi/cn/img/Retail_cn.png
similarity index 100%
rename from src/document/tpl/img/Retail_cn.png
rename to src/document/openapi/cn/img/Retail_cn.png
diff --git a/src/document/tpl/img/RoyalPay_Gateway_choose_cn.jpg b/src/document/openapi/cn/img/RoyalPay_Gateway_choose_cn.jpg
similarity index 100%
rename from src/document/tpl/img/RoyalPay_Gateway_choose_cn.jpg
rename to src/document/openapi/cn/img/RoyalPay_Gateway_choose_cn.jpg
diff --git a/src/document/tpl/img/alipayOnline_cn.png b/src/document/openapi/cn/img/alipayOnline_cn.png
similarity index 100%
rename from src/document/tpl/img/alipayOnline_cn.png
rename to src/document/openapi/cn/img/alipayOnline_cn.png
diff --git a/src/document/tpl/img/glyphicons-halflings-white.png b/src/document/openapi/cn/img/glyphicons-halflings-white.png
similarity index 100%
rename from src/document/tpl/img/glyphicons-halflings-white.png
rename to src/document/openapi/cn/img/glyphicons-halflings-white.png
diff --git a/src/document/tpl/img/glyphicons-halflings.png b/src/document/openapi/cn/img/glyphicons-halflings.png
similarity index 100%
rename from src/document/tpl/img/glyphicons-halflings.png
rename to src/document/openapi/cn/img/glyphicons-halflings.png
diff --git a/src/document/tpl/img/h5_api_payment.jpg b/src/document/openapi/cn/img/h5_api_payment.jpg
similarity index 100%
rename from src/document/tpl/img/h5_api_payment.jpg
rename to src/document/openapi/cn/img/h5_api_payment.jpg
diff --git a/src/document/tpl/img/jd_cn.png b/src/document/openapi/cn/img/jd_cn.png
similarity index 100%
rename from src/document/tpl/img/jd_cn.png
rename to src/document/openapi/cn/img/jd_cn.png
diff --git a/src/document/tpl/img/logo.png b/src/document/openapi/cn/img/logo.png
similarity index 100%
rename from src/document/tpl/img/logo.png
rename to src/document/openapi/cn/img/logo.png
diff --git a/src/document/openapi/cn/img/logo_new.jpg b/src/document/openapi/cn/img/logo_new.jpg
new file mode 100644
index 000000000..41c02602a
Binary files /dev/null and b/src/document/openapi/cn/img/logo_new.jpg differ
diff --git a/src/document/tpl/img/microapp_cn.png b/src/document/openapi/cn/img/microapp_cn.png
similarity index 100%
rename from src/document/tpl/img/microapp_cn.png
rename to src/document/openapi/cn/img/microapp_cn.png
diff --git a/src/document/openapi/cn/img/rp_logo.svg b/src/document/openapi/cn/img/rp_logo.svg
new file mode 100644
index 000000000..d57a76e21
--- /dev/null
+++ b/src/document/openapi/cn/img/rp_logo.svg
@@ -0,0 +1,58 @@
+
+
+
+
diff --git a/src/document/tpl/img/sdk_api_payment.jpg b/src/document/openapi/cn/img/sdk_api_payment.jpg
similarity index 100%
rename from src/document/tpl/img/sdk_api_payment.jpg
rename to src/document/openapi/cn/img/sdk_api_payment.jpg
diff --git a/src/document/tpl/img/sdk_wechat_api_payment_cn.png b/src/document/openapi/cn/img/sdk_wechat_api_payment_cn.png
similarity index 100%
rename from src/document/tpl/img/sdk_wechat_api_payment_cn.png
rename to src/document/openapi/cn/img/sdk_wechat_api_payment_cn.png
diff --git a/src/document/openapi/cn/index.html b/src/document/openapi/cn/index.html
new file mode 100644
index 000000000..6b6d61ff8
--- /dev/null
+++ b/src/document/openapi/cn/index.html
@@ -0,0 +1,23 @@
+
+
+
+
+ RoyalPay Document
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/document/openapi/en/components_order.yml b/src/document/openapi/en/components_order.yml
new file mode 100644
index 000000000..26c44a097
--- /dev/null
+++ b/src/document/openapi/en/components_order.yml
@@ -0,0 +1,410 @@
+
+orderBasic:
+ required:
+ - description
+ - currency
+ - price
+ properties:
+ description:
+ type: string
+ maxLength: 128
+ description: Order title(Max 128 characters. Will cut automatically if too long.)
+ price:
+ type: integer
+ description: Order price. Minimal unit of currency. eg, 100 for AUD 1.00
+ currency:
+ type: string
+ enum:
+ - AUD
+ - CNY
+ notify_url:
+ type: string
+ description: payment notification url. for details please visit notify api. will not post notifications if leave it null. Recommended to call order query api to confirm order status when received notification.
+ operator:
+ type: string
+ description: mark of operator
+orderWithChannel:
+ allOf:
+ - $ref: '#/orderBasic'
+ - properties:
+ channel:
+ type: string
+ description: order channel. case sensitive
+ enum:
+ - Alipay
+ - Wechat
+ type: object
+ required:
+ - channel
+cardCustomerParam:
+ properties:
+ name:
+ type: string
+ description: customer name. will use card holder name if leave it empty
+ postcode:
+ type: string
+ example: 2000
+ address:
+ type: string
+ city:
+ type: string
+ example: Sydney
+ state:
+ type: string
+ example: VIC
+ country:
+ type: string
+ description: 2-character country code
+ example: AU
+
+cardCustomerInfo:
+ type: object
+ title: Card customer info
+ properties:
+ bank:
+ type: string
+ description: bank name who issued the card. may be empty
+ card_type:
+ type: string
+ description: card type
+ example: credit/debit
+ card_alias:
+ type: string
+ description: part of card number. for customers to recognize which card they used
+ example: 424242...242
+ card_scheme:
+ description: card scheme who issued the card
+ type: string
+ example: VISA/MASTER
+ card_country:
+ description: nation code who issued the card
+ type: string
+ example: AU
+ customer_id:
+ type: string
+ description: customer id. if you provided customer_id param or passed tokenize=true param. it will appear
+orderBasicResponse:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: execute result
+ result_code:
+ type: string
+ description: SUCCESS/EXISTS all means success. EXISTS means the order_id was not first time to commit
+ channel:
+ type: string
+ description: payment channel
+ partner_code:
+ type: string
+ description: merchant code
+ full_name:
+ type: string
+ description: merchant full name
+ partner_name:
+ type: string
+ description: merchant name
+ order_id:
+ type: string
+ description: RoyalPay order ID, Will be channel order ID same time.
+ partner_order_id:
+ type: string
+ description: order id applied by merchant
+orderStatus:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: execute result
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: |
+ order status code
+ - PAYING: waiting for payment
+ - CREATE_FAIL: creation failed(final status, can be actived again if submitted another create order with same order id)
+ - CLOSED: order closed(final status, can be actived again if submitted another create order with same order id)
+ - PAY_FAIL: payment failed(final status, can be actived again if submitted another create order with same order id)
+ - PAY_SUCCESS: payment success(final status)
+ - PARTIAL_REFUND: payment success and partial refunds happened(final status)
+ - FULL_REFUND: payment success and was full refunded(final status)
+ If necessary. you can use same order id to call create order api in same gateway. but when origin order is paid or paying status will be failure
+ enum:
+ - PAYING
+ - CREATE_FAIL
+ - CLOSED
+ - PAY_FAIL
+ - PAY_SUCCESS
+ - PARTIAL_REFUND
+ - FULL_REFUND
+ order_id:
+ type: string
+ description: RoyalPay order ID, Will be channel order ID same time.
+ partner_order_id:
+ type: string
+ description: order id applied by merchant
+ channel_order_id:
+ type: string
+ description: transaction id from payment channel
+ total_fee:
+ type: integer
+ description: order amount. minimal unit of the currency.
+ real_fee:
+ type: integer
+ description: customer actual paid amount. minimal unit of the currency.(equals to total_fee at this moment. in case there were some discounts in the future)
+ currency:
+ type: string
+ rate:
+ type: number
+ description: exchange rate of trading. 1AUD=?CNY
+ pay_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-mm-dd HH:mm:ss
+ description: paid time(yyyy-MM-dd HH:mm:ss, GMT+10)
+ create_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-mm-dd HH:mm:ss
+ description: order creation time(yyyy-MM-dd HH:mm:ss, GMT+10)
+ channel:
+ type: string
+ description: payment channel
+ customer_info:
+ anyOf:
+ - description: Alipay User Info
+ title: Alipay Users
+ type: object
+ properties:
+ alipay_user_id:
+ type: string
+ description: Alipay user id
+ alipay_account:
+ type: string
+ description: user account
+ - $ref: 'components_order.yml#/cardCustomerInfo'
+refundStatus:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: Execute result
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: |
+ Refund status
+ - WAITING: Submitting
+ - CREATE_FAILED: Submit failed
+ - SUCCESS: Submit success. waiting for bank processing(for Wechat, it's final status)
+ - FAILED: Refund failed
+ - FINISHED: Refund success (final status)
+ enum:
+ - WATING
+ - CREATE_FAILED
+ - SUCCESS
+ - FAILED
+ - FINISHED
+ refund_id:
+ type: string
+ description: RoyalPay Refund ID
+ partner_refund_id:
+ type: string
+ description: Refund id submitted by merchant
+ amount:
+ type: integer
+ description: refund amount. minimal unit of the currency.
+ currency:
+ type: string
+ example:
+ AUD
+transactionItem:
+ type: object
+ properties:
+ transaction_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyyMMddHHmmss
+ description: trading time, format is yyyyMMddHHmmss, GMT+10
+ partner_code:
+ type: string
+ description: transaction related partner code
+ order_id:
+ type: string
+ description: RoyalPay order id
+ partner_order_id:
+ type: string
+ description: merchant order id
+ channel_order_id:
+ type: string
+ description: channel order id
+ refund_id:
+ type: string
+ description: RoyalPay refund id (only exists on refund or refund failure payback transactions)
+ partner_refund_id:
+ type: string
+ description: merchant submitted refund id (only exists on refund or refund failure payback transactions)
+ gateway:
+ type: integer
+ description: |
+ gateway
+ - 0: RoyalPay EftPOS with payment code (scanning payment code provided by customer)
+ - 1: RoyalPay EftPOS with collection code (customer scan qr code provided by EftPOS)
+ - 2: RoyalPay Merchant's static QR Code
+ - 3: QRCode Gateway
+ - 4: JSAPI Gateway
+ - 5: Third EftPOS payment code gateway
+ - 6: Third EftPOS collection code gateway
+ - 7: RoyalPay Merchant's static QR Code(deprecated)
+ - 8: H5 Gateway
+ - 9: WEB Gateway
+ - 10: SDK order Gateway
+ - 11: RoyalPay Bill QR Code
+ - 12: Mini Program Gateway
+ - 13: Native QR Code Gateway
+ - 14: RoyalPay Bill link
+ - 15: Native JSAPI Gateway
+ - 16: Card Order(Pre order mode)
+ - 17: Card Order
+ - 18: DirectDebit
+ channel:
+ type: string
+ description: Trading channel
+ type:
+ type: string
+ description: Transaction type
+ enum:
+ - Credit
+ - Debit
+ currency:
+ type: string
+ example:
+ AUD
+ total_amount:
+ type: integer
+ description: Total amount for order. minimal unit of the currency.
+ input_amount:
+ type: integer
+ description: Input amount for order. minimal unit of the currency.
+ customer_payment_amount:
+ type: integer
+ description: Customer actual paid amount. minimal unit of the currency.
+ settle_amount:
+ type: integer
+ description: Amount calculated to merchant. note that it did not sub surcharge and GST yet. AUD currency. minimal unit of the currency.
+ transfer_amount:
+ type: integer
+ description: Pay amount to merchant. settle_amount - surcharge - GST. AUD currency. minimal unit of the currency.
+ surcharge:
+ type: integer
+ description: surcharge for this transaction. AUD currency. minimal unit of the currency.
+ gst:
+ type: integer
+ description: GST. AUD currency. minimal unit of the currency.
+ exchange_rate:
+ type: number
+ description: used exchange rate.
+ remark:
+ type: string
+ description: transaction remark
+customInfo:
+ type: object
+ properties:
+ report_id:
+ type: string
+ description: RoyalPay customs report id
+ client_report_id:
+ type: string
+ description: merchant submitted customs report id
+ report_status:
+ type: string
+ description: report status
+ enum:
+ - PROCESSING
+ - SUBMITED
+ - FAILED
+ - SUCCESS
+ channel:
+ type: string
+ description: payment channel
+ custom:
+ type: string
+ description: customs code
+ mch_custom_no:
+ type: string
+ description: merchant's customs no registered in customs system
+ mch_custom_name:
+ type: string
+ description: merchant's name registered in customs system
+ order_id:
+ type: string
+ description: RoyalPay order id
+ transaction_id:
+ type: string
+ description: channel transaction id
+ order_currency:
+ type: string
+ description: order currency
+ order_amount:
+ type: number
+ description: order amount
+ report_time:
+ type: string
+ format: 'date-time'
+ description: report customs time
+ creation_date:
+ format: 'date-time'
+ type: string
+ description: report create time
+ last_update_date:
+ type: string
+ format: 'date-time'
+ description: update time
+ error_code:
+ type: string
+ description: error code
+ error_msg:
+ type: string
+ description: error message
+ verify_department:
+ type: string
+ verify_department_trade_id:
+ type: string
+ sub_orders:
+ type: array
+ items:
+ type: object
+ properties:
+ sub_order_no:
+ type: string
+ description: merchant's sub order no
+ fee_type:
+ type: string
+ description: currency code
+ default: CNY
+ enum:
+ - CNY
+ order_fee:
+ type: number
+ description: sub order fee
+ transport_fee:
+ type: number
+ description: sub order transport fee
+ verify_department:
+ type: string
+ verify_department_trade_id:
+ type: string
+ report_status:
+ type: string
+ description: report status
+ enum:
+ - PROCESSING
+ - SUBMITED
+ - FAILED
+ - SUCCESS
+ error_code:
+ type: string
+ error_msg:
+ type: string
\ No newline at end of file
diff --git a/src/document/openapi/en/document.yml b/src/document/openapi/en/document.yml
new file mode 100644
index 000000000..cbbfc515e
--- /dev/null
+++ b/src/document/openapi/en/document.yml
@@ -0,0 +1,1356 @@
+openapi: 3.0.3
+info:
+ title: RoyalPay Developer Documents
+ version: 1.0.0
+ x-logo:
+ url: img/rp_logo.svg
+ description: |
+ [中文](/cn/)
+
+ # Request And Parameters
+ Request for payment or refund shall use PUT method. Request for querying order
+ shall use GET method. All requests including Request Entity are in JSON format.
+
+ 除跳转页面外,所有的Accept均为application/json;所有的PUT/POST请求Content-Type为application/json
+
+ Accept in the request header shall be set to application/json for all requests except redirect pages.
+ Content-Type in the request header shall be set to application/json for all PUT/POST requests.
+
+ System charset is UTF-8.
+
+ There are 3 groups of parameters: Path Variable, Query Param, JSON Entity
+ + Path Variable: included in the path as patterns
+ + Query Param: parameters after the URI '?' symbol and formatted like key=value
+ + JSON Entity: only used in PUT/POST requests
+
+ Our API server will return 200 in JSON if the request has successfully reached the server, which does not indicate the success or failure of the actual operation. All responses in JSON format will include a return_code field which contains the operation result. The value SUCCESS indicates that the operation was successful while other values shows the type of error that happened. Response will also contain a return_msg field for detailed error message.
+
+ # Multi-Language
+
+ System error message supports Simplified Chinese and English. The system by default will automatically choose the language according to the Accept-Language value in request header. Cookie "locale" value (zh-CN or en-US) will affect the result language.
+
+ ## Which Gateway Api is for me?
+
+
+
+ # Alipay Channels
+
+ According to different Api used, Alipay channel was distributed to Retail channel and Online channel. Two channels has different exchange rate and surcharge rate.
+ + Online Channel: Including H5 Mobile, Online Payment, APP SDK, JSAPI and QR Code Api
+ + Retail Channel: Including Retail Pay
+
+ Difference
+ - JSAPI and H5 Mobile: JSAPI can only be called in the web page opened in Alipay Client. H5 Mobile can call the payment panel in any browser or webview in App in the mobile device.
+ - Online Payment and QR Code: Online payment will jump to Alipay Official payment page. Customers can scan QR Code displayed in the page or sign in their account directly to finish payment. QR Code can provide a QR Code. Merchants can display this QR Code in their web page or jump to RoyalPay to display the QR Code. Customers can only scan the QR Code with their Alipay Client to finish payment.
+
+ # Currency Codes
+
+ RoyalPay can only accept the following currencies at the moment. Please note that the settlement currency will always be Australian Dollar.
+ - AUD
+ - CNY
+
+ Except customs api. All fee parameters should use *Minimal unit of the currency*. For example, CNY and AUD should use cent unit. so AUD 1.00 should submit the parameter as 100
+
+ # Business Roles
+ - QR Code Payment displays a QR code image in a web page. Customers will scan the code via their WeChat and complete the payment in the linked web page. It is suitable for online shopping websites.
+ - JSAPI Payment redirects customers to a web page in WeChat. This page can only be opened within WeChat app and it is suitable for payment from micro-shops on WeChat platform.
+ - Retail passive payment(Scan Payment Code in customers’ WeChat Wallet) and active payment(Generate Payment QR Code for customers to scan) are used in retail environment such as payment terminals and pos machines.
+ - Order ID is required when creating an order. The same order id can be sent again. The system will decide to renew an order or close the old order according to the order status. System will recognise the same order id to avoid duplicated payments from customers.
+ - As orders can be resubmitted, Order ID returned by our server might not represent the last Order ID paid.
+ - QR Code order creation will return QR Code and pay_url. Merchants may decide whether to display the QR code on their website or to redirect customer to the payment page available at pay_url.
+ - JSAPI order creation will return pay_url. Merchants shall redirect customer to the payment page available at pay_url, and complete the payment.
+ - When redirecting to pay_url, sign information is required.
+ - Each request shall use new timestamp, nonce_str and sign.
+ - Our system will notify the caller after an order is paid successfully if notify_url was provided when creating an order. Otherwise, Merchants shall call the order query method repeatedly until order is paid or closed.
+ - Each unpaid order will be valid for 5 minutes. Expired order can be renewed with same the order id. It is suggested to trigger the event when user open the payment page again.
+ - Always redirect to RoyalPay’s payment page after calling the order creation method.
+ - Same order id is allowed in both creating new payment order and creating refund order but order details shall refer back to the initial request details.
+ - Price is specified in the base unit of the given currency. Using currency AUD as an example, 105 means 105 cents or $1.05.
+
+ # Examples
+ https://example.royalpay.com.au/api/payment/order
+
+
+
+ # Sample Code
+ - PHP: https://mpay.royalpay.com.au/static/phpdemo.zip
+ - Java: https://mpay.royalpay.com.au/static/javademo.zip
+
+ # Error Codes
+ ## Common Error Codes
+ - SYSTEMERROR: Internel server error
+ - INVALID_SHORT_ID: Invalid partner code or not found
+ - SIGN_TIMEOUT: Signatured timedout. submitted time param has more than 5min difference to our server. please check your server time and timezone configuration.
+ - SIGN_EXPIRED: Signature expired. same signature was used multiple times.
+ - INVALID_SIGN: Signature mismatch
+ - PARAM_INVALID: Parameter not valid. Please check thr return_msg param
+
+ ## Order Creation Error Codes
+ - NOT_PERMITTED: Not enabled the target gateway permission.
+ - INVALID_CHANNEL: Invalid channel name. channel name parameter was case-sensitive. please check spelling
+ - ORDER_MISMATCH: Order id not belongs to your merchant
+ - AUTHCODEEXPIRE: QR Code provided was expired(For Payment code apis)
+ - NOTSUPORTCARD: Not supported card type(Wechat channel only)
+ - AUTH_CODE_ERROR: QR Code submitted multiple times(Wechat channel only)
+ - AUTH_CODE_INVALID: Invalid QR Code(Wechat channel only)
+ - NOTENOUGH: Not enough balance in customer's account(Wechat channel only)
+ - ORDER_PAID: Order already paid
+
+servers:
+ - url: https://mpay.royalpay.com.au/api/v1.0
+ description: production
+ - url: https://sandbox.royalpay.com.au/api/v1.0
+ description: sandbox
+tags:
+ - name: PublicApi
+ description: Public API
+ - name: QRCode
+ description: |
+ QR Code Payment is used for webpage/application on PC. Customers use WeChat or Alipay app to scan QR Code generated when creating order and finish the payment.
+
+ Return value contains QR Code string, QR Ccode image and payment page address. Partners can decide how to finish the payment.
+ If the currency is CNY, equivalent AUD amount shall never less than 0.01AUD, otherwise user will get Invalid Amount Error from WeChat when making the payment.
+ - name: JSAPI
+ description: |
+ JSAPI Payment is used to pay in webpage which was opened in WeChat or Alipay App. If customers enter this page from WeChat Official Account, this Official Account is required to be authorized.
+ Customers will jump to RoyalPay order page and call WeChat or Alipay Payment Board to finish payment.
+
+ Return value contains a payment page. Partners shall guide users to redirect to the page. Sign params is required when redirect happens.
+ If the currency is CNY, equivalent AUD amount shall never less than 0.01AUD,
+ otherwise user will get Invalid Amount Error from WeChat when making the payment.
+ - name: MobileH5
+ description: |
+ Create H5 order. Only Alipay supports.
+ H5 Payment is used for payment in Webpage or App on mobile outside WeChat or Alipay App. The browser would redirect to a webpage from WeChat or Alipay and call the App to finish the payment.
+ Return value contains a payment page. Partners shall guide users to redirect to this page. Sign params are required.
+ If the currency is CNY, equivalent AUD amount shall never less than 0.01AUD, otherwise user will get Invalid Amount Error from WeChat when making the payment.
+
+ - name: MiniProgram
+ description: |
+ Enabling Wechat mini program have to finish oversea company authorization. And authorized merchant should be equal to the merchant information in RoyalPay.
+ For details please visit WeChat documents.
+ Used for call payment in miniprogram. Create order and pass the sdk_params to mini program. [Reference Document](https://www.royalpay.com.au/downloads/MiniProgram_WechatPay.pdf)
+
+ - name: CardPayment
+ description: |
+ Card payment method is that customer provider their card information to finish payments. Enable card payment require addition compliance process.
+ - name: RetailPay
+ description: |
+ Retail payment API for merchants has their own machine. Has 2 modes:
+ - Merchant scanner scan customer provided payment code.(B scan C)
+ - Customer scan merchant provided collection code. (C scan B)
+ - name: AlipayOnline
+ description: |
+ Use for Alipay Payment in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param. Then enter Alipay page to finish payment.
+ Alipay Channel only
+
+ - name: CB Bank
+ description: |
+ Use for CB BankPay in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param.
+ - name: SDK Payment
+ description: |
+ Used for mobile Apps calling Wechat payment with Wechat/Alipay SDK.
+ Call this api to create order and get param string for SDK calling. Call SDK api with the param to start payment and get payment result from Wechat app *It is strongly advised to request RoyalPay order query Api to confirm that the order has been paid in order to cancelling order by system at the same time.*
+
+ More information for integration with Alipay: [Alipay SDK Document](https://global.alipay.com/doc/app/intro)
+ More information for integration with Alipay: [Wechat SDK Document](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1)
+ [Alipay SDK for Android](resources/api/alipaySdk-20160825.jar)
+ [Alipay SDK for iOS](resources/api/AlipaySDKForiOS.zip)
+ [Wechat SDK for Android](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN)
+ [Wechat SDK for iOS](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN)
+
+ - name: Custom
+ description: Used to submit the attachment information of the order required by the merchant. WeChat and Alipay are only supported. WeChat only supports payment orders within one month for customs declaration.
+security:
+ - sign: []
+ nonce_str: []
+ time: []
+paths:
+ /gateway/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ tags:
+ - QRCode
+ summary: Create QRCode Order
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderWithChannel'
+ responses:
+ 200:
+ description: Execution result
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ code_url:
+ type: string
+ description: QR Code string. Merchants can generate a QR Code by self
+ qrcode_img:
+ type: string
+ description: Base64 encoded qr code img. can be used as src attribute of img tag
+ pay_url:
+ type: string
+ description: Payment page URL. If merchants choose jump to royalpay to finish payment can use this url. remember to add signature params
+ get:
+ summary: Check Order Status
+ tags:
+ - SDK Payment
+ - CB Bank
+ - RetailPay
+ - AlipayOnline
+ - CardPayment
+ - MiniProgram
+ - MobileH5
+ - JSAPI
+ - QRCode
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ responses:
+ 200:
+ description: Order Status
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderStatus'
+ delete:
+ summary: Close Order
+ tags:
+ - SDK Payment
+ - CB Bank
+ - RetailPay
+ - AlipayOnline
+ - CardPayment
+ - MiniProgram
+ - MobileH5
+ - JSAPI
+ - QRCode
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ responses:
+ 200:
+ description: Order Status
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderStatus'
+ /gateway/partners/{partner_code}/native_orders/{partner_order_id}:
+ put:
+ tags:
+ - QRCode
+ summary: Create native QRCode payment order
+ description: |
+ Native QR Code was generated directly by wechat/alipay. When scanned by their app. The payment page will directly generated by App instead of jumping to royalpay.
+ Will be helpful when customers are in a bad networking condition
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderWithChannel'
+ responses:
+ 200:
+ description: Execute result
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ code_url:
+ type: string
+ description: QR Code string. Merchants can generate a QR Code by self
+ qrcode_img:
+ type: string
+ description: Base64 encoded qr code img. can be used as src attribute of img tag
+ pay_url:
+ type: string
+ description: Payment page URL. If merchants choose jump to royalpay to finish payment can use this url. remember to add signature params
+ /gateway/partners/{partner_code}/orders/{partner_order_id}/pay:
+ get:
+ tags:
+ - QRCode
+ summary: QRCode payment Page
+ description: Must call order creation api and then redirect to this page. It's recommended to call order check api when sync jumping back to the given redirect param
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ - name: redirect
+ required: true
+ in: query
+ description: Redirecting target when payment succeeded
+ responses:
+ 200:
+ description: payment page
+ content:
+ text/html:
+ schema:
+ type: string
+ /jsapi_gateway/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: Create JSAPI order
+ tags:
+ - JSAPI
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderWithChannel'
+ responses:
+ 200:
+ description: Execute Result
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: Payment page URL, redirect to the url with signature parameters.
+ /wechat_jsapi_gateway/partners/{partner_code}_order_{partner_order_id}:
+ get:
+ summary: Wechat JSAPI payment page
+ description: Wechat JSAPI payment page. it's recommended to use the returned pay_url param in create order response
+ tags:
+ - JSAPI
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ - name: redirect
+ in: query
+ description: sync callback url. pay attention on url encoding
+ - name: directpay
+ in: query
+ description: whether call payment immediately when customer entered the page. if false, customer have to click on Pay button to call payment.
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: Wechat JSAPI payment page
+ content:
+ text/html:
+ schema:
+ type: string
+ /gateway/alipay/partners/{partner_code}/orders/{partner_order_id}/app_pay:
+ get:
+ summary: Alipay JSAPI Payment page
+ description: Alipay JSAPI payment page. it's recommended to use the returned pay_url param in create order response
+ tags:
+ - JSAPI
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ - name: redirect
+ in: query
+ description: sync callback url. pay attention on url encoding
+ - name: directpay
+ in: query
+ description: whether call payment immediately when customer entered the page. if false, customer have to click on Pay button to call payment.
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: Alipay JSAPI payment page
+ content:
+ text/html:
+ schema:
+ type: string
+ /h5_payment/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: Create MobileH5 order
+ description: only for Alipay channel
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ tags:
+ - MobileH5
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ properties:
+ channel:
+ type: string
+ description: channel. case sensitive
+ enum:
+ - Alipay
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ type: object
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: Payment page URL. redirect to the url with signature parameters.
+ /h5_payment/partners/{partner_code}/orders/{partner_order_id}/pay:
+ get:
+ summary: H5 Payment page
+ description: H5 payment page. it's recommended to use the returned pay_url param in create order response
+ tags:
+ - MobileH5
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ - name: redirect
+ in: query
+ description: sync callback url. pay attention on url encoding
+ responses:
+ 200:
+ description: H5 Payment page
+ content:
+ text/html:
+ schema:
+ type: string
+ /gateway/partners/{partner_code}/microapp_orders/{partner_order_id}:
+ put:
+ summary: Create mini program order
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ tags:
+ - MiniProgram
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderWithChannel'
+ - type: object
+ properties:
+ appid:
+ type: string
+ description: mini program appid. required when channel is Wechat. ignore on Alipay
+ customer_id:
+ type: string
+ description: user id recognized in mini program (openid or wechat and userid for Alipay)
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ sdk_params:
+ type: string
+ description: serialized json string. can pass to mini program to call payment method
+ /gateway/partners/{partner_code}/pre_card_orders/{partner_order_id}:
+ put:
+ summary: Create Card Payment Pre Order
+ description: |
+ Pre order mode is submit basic order parameters. and jump to royalpay gateway page to ask customers to input their card information and finish payment.
+ Pre order allows customers to try multiple times. unless merchants called order close api. order will exists enabled status until expired.
+ tags:
+ - CardPayment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ properties:
+ domestic_only:
+ type: boolean
+ default: false
+ description: whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards. merchants can add a limit on the order.
+ disable_credit_card:
+ type: boolean
+ default: false
+ description: pass true if merchant want to disable credit cards from paying to this order.
+ tokenize:
+ type: boolean
+ default: false
+ description: whether provide a customer id for this payment. Then merchants can pass this id in future orders for same customer and then they will only have to input cvv code then.
+ customer_id:
+ type: string
+ description: use customer_id provided by tokenized orders. When customer_id is not null, tokenize parameter will be ignored. Can skip steps for typing in card number/ card holder name/ expire time for customer. only required is CVV2/CVC code
+ customer:
+ $ref: 'components_order.yml#/cardCustomerParam'
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: Payment page URL. redirect to the url with signature parameters.
+ /card_payment_view/partners/{partner_code}/orders/{partner_order_id}/view:
+ get:
+ summary: Card Payment Page
+ description: Card payment page. it's recommended to use the returned pay_url param in create order response
+ tags:
+ - CardPayment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ - name: redirect
+ in: query
+ description: sync callback url. pay attention on url encoding
+ responses:
+ 200:
+ description: Card payment page
+ content:
+ text/html:
+ schema:
+ type: string
+ /gateway/partners/{partner_code}/card_orders/{partner_order_id}:
+ put:
+ summary: Create Card Order
+ description: |
+ 商户可在页面引入https://channel.rpayplus.com/channel/v1/view/card_input_frame.js
+ 并通过回调取得key_id和secret信息,并将其作为卡信息提交给royalpay直接完成下单支付。
+
+ js引用案例:
+ ```
+ let cardInputContainer = document.getElementById('card-input-area');//预先准备放置卡输入界面的container
+ let cardInput = new CardInputFrame(cardInputContainer);//创建frame对象
+ //设置iframe的样式参数
+ cardInput.frameStyle = {
+ width: '100%',
+ height: '400px',
+ border: 'none',
+ borderRadius: '10px'
+ };
+ cardInput.onError = function(msg){
+ //卡输入界面返回错误信息时进行展示
+ };
+ cardInput.onReady = function(){
+ //iframe加载完毕的触发事件
+ };
+ cardInput.onSuccess = function(secretData){
+ //成功取得加密卡信息回调
+ //secretData: {'key_id':'','secret':''}
+ };
+ cardInput.show();//开始加载iframe
+
+ //通过外部事件触发卡输入界面提交,注意卡输入界面没有按钮,必须通过外部触发提交事件。并回调到onSuccess回调函数。
+ cardInput.commit();
+ ```
+ tags:
+ - CardPayment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - key_id
+ - card_info
+ properties:
+ key_id:
+ type: string
+ description: 卡输入界面回调得到的key_id
+ card_info:
+ type: string
+ description: 卡输入界面回调得到的secret
+ domestic_only:
+ type: boolean
+ default: false
+ description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。
+ disable_credit_card:
+ type: boolean
+ default: false
+ description: 如果希望禁止消费者使用信用卡支付可传入true
+ customer:
+ $ref: 'components_order.yml#/cardCustomerParam'
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderBasicResponse'
+ /micropay/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 付款码下单
+ description: |
+ 线下支付订单接口用于带有扫码设备的收银终端进行对接,商户输入金额后要求客户出示支付码,用扫码枪扫码后将扫码内容和金额一并提交并完成支付操作。
+ 线下支付订单接口现已兼容微信、支付宝通道。可根据付款码自动识别交易渠道。
+
+ tags:
+ - RetailPay
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - auth_code
+ - device_id
+ properties:
+ device_id:
+ type: string
+ description: 扫码设备id
+ auth_code:
+ type: string
+ description: 付款码
+ responses:
+ 200:
+ description: Result
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderStatus'
+ /retail_qrcode/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 线下QRCode支付单
+ description: |
+ 线下QRCode支付用于对接无扫码设备的收银终端,下单后得到二维码地址,自行生成二维码图片后展示在收银终端屏幕上,并由用户使用对应支付客户端进行扫码支付。 线下QRCode现已同时兼容支付宝、微信客户端进行支付
+
+ tags:
+ - RetailPay
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - device_id
+ properties:
+ device_id:
+ type: string
+ description: 收银设备id
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ code_url:
+ type: string
+ description: 付款码字符串,商户可自行生成二维码 # todo
+ /alipay/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 支付宝WEB订单下单
+ description: |
+ 创建订单后跳转到返回的pay_url(需附加签名参数和redirect参数),随后进入支付宝支付页面完成支付
+ 该接口现仅支持支付宝。
+ tags:
+ - AlipayOnline
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/orderBasic'
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: Payment page URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /cb_bankpay/partners/{partner_code}/orders/{partner_order_id}:
+ put:
+ summary: 网银快捷支付下单
+ tags:
+ - CB Bank
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - product_name
+ - gateway_type
+ properties:
+ product_name:
+ type: string
+ description: 商品名称
+ gateway_type:
+ type: integer
+ description: '网关类型,8: H5网关,9:PC网关'
+ enum:
+ - 8
+ - 9
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ pay_url:
+ type: string
+ description: Payment page URL,加签后传递给前端并跳转至当前URL,让消费者完成支付
+ /gateway/partners/{partner_code}/app_orders/{partner_order_id}:
+ put:
+ summary: SDK下单
+ tags:
+ - SDK Payment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ description: Given partner code
+ - name: partner_order_id
+ in: path
+ required: true
+ description: Order id in merchant side. must be unique in merchant side.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasic'
+ - type: object
+ required:
+ - channel
+ properties:
+ channel:
+ type: string
+ description: 支付渠道,大小写敏感
+ enum:
+ - Wechat
+ - Alipay
+ system:
+ type: string
+ description: 客户端操作类型,支付宝选填,微信不需要
+ enum:
+ - android
+ - iphone
+ - ipad
+ version:
+ type: string
+ description: 客户端版本号,支付宝选填,微信不需要
+ appid:
+ type: string
+ description: 微信必填,开发者平台appid
+ responses:
+ 200:
+ description: Order
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: 'components_order.yml#/orderBasicResponse'
+ - type: object
+ properties:
+ sdk_params:
+ type: string
+ description: json字符串,可直接传递给SDK端发起支付
+ /gateway/partners/{partner_code}/channel_exchange_rate:
+ get:
+ summary: 渠道汇率查询
+ description: 获取当前各渠道AUD兑CNY汇率值(1AUD=?CNY),该汇率仅做参考,以实际成交汇率为准
+ tags:
+ - PublicApi
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ responses:
+ 200:
+ description: exchange rate
+ content:
+ application/json:
+ schema:
+ type: object
+ description: OK
+ properties:
+ return_code:
+ type: string
+ description: 状态码
+ example:
+ SUCCESS
+ wechat_rate:
+ type: number
+ description: 微信当前汇率
+ example:
+ 4.41111
+ alipay_retail_rate:
+ type: number
+ description: 支付宝线下接口汇率
+ example:
+ 4.411111
+ alipay_online_rate:
+ type: number
+ description: 支付宝线上汇率
+ example:
+ 4.411111
+ /gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}:
+ put:
+ summary: 发起退款
+ description: 一笔支付订单可以分多次退款,退款总金额不得超过实际支付金额,退款币种与支付订单一致
+ tags:
+ - QRCode
+ - JSAPI
+ - MobileH5
+ - MiniProgram
+ - CardPayment
+ - AlipayOnline
+ - RetailPay
+ - CB Bank
+ - SDK Payment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 需要退款订单的单号
+ - name: partner_refund_id
+ in: path
+ required: true
+ description: 退款单号
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - fee
+ properties:
+ fee:
+ type: integer
+ description: 退款金额,单位是货币最小单位,单个订单退款单金额总和不能超过用户支付金额
+ device_id:
+ type: string
+ description: 操作设备id
+ responses:
+ 200:
+ description: Refund
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/refundStatus'
+ get:
+ summary: 查询退款
+ tags:
+ - QRCode
+ - JSAPI
+ - MobileH5
+ - MiniProgram
+ - CardPayment
+ - AlipayOnline
+ - RetailPay
+ - CB Bank
+ - SDK Payment
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: partner_order_id
+ in: path
+ required: true
+ description: 订单的单号
+ - name: partner_refund_id
+ in: path
+ required: true
+ description: 退款单号
+ responses:
+ 200:
+ description: Refund Status
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/refundStatus'
+ /gateway/partners/{partner_code}/transactions:
+ get:
+ summary: 查询流水
+ description: |
+ 本接口将列出商户当日所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等,不含清算信息
+ 注意一笔付款订单或退款订单均可能对应多条流水记录
+ tags:
+ - PublicApi
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: date
+ schema:
+ format: date
+ pattern: yyyyMMdd
+ type: string
+ in: query
+ required: true
+ description: 账单日期,'yyyyMMdd'格式,GMT+10,只能查今天以前的账单
+ example: 20200315
+ responses:
+ 200:
+ description: Orders
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: Execute Result
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: 业务Execute Result
+ example:
+ SUCCESS
+ transaction_count:
+ type: integer
+ description: 流水条数
+ order_count:
+ type: integer
+ description: 付款条数
+ refund_count:
+ type: integer
+ description: 退款条数
+ transactions:
+ type: array
+ items:
+ $ref: 'components_order.yml#/transactionItem'
+ /gateway/partners/{partner_code}/settlements:
+ get:
+ summary: 查看清算详情
+ description: |
+ 本接口将列出商户查询日期清算的所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等
+ 注意一笔付款订单或退款订单均可能对应多条流水记录
+ tags:
+ - PublicApi
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: date
+ in: query
+ schema:
+ format: date
+ pattern: yyyyMMdd
+ type: string
+ description: 清算日期,'yyyyMMdd'格式,GMT+10,只能查今天以前
+ required: true
+ responses:
+ 200:
+ description: Settlements
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ return_code:
+ type: string
+ description: Execute Result
+ example:
+ SUCCESS
+ result_code:
+ type: string
+ description: 业务Execute Result
+ example:
+ SUCCESS
+ settle_from:
+ type: string
+ format: date
+ description: 订单起始日期:yyyyMMdd
+ settle_to:
+ type: string
+ format: date
+ description: 订单截止日期:yyyyMMdd
+ settle_days:
+ type: string
+ description: 清算周期
+ example:
+ T+2
+ transaction_count:
+ type: integer
+ description: 流水条数
+ order_count:
+ type: integer
+ description: 付款条数
+ refund_count:
+ type: integer
+ description: 退款条数
+ total_credit:
+ type: integer
+ description: 入账总金额(AUD分)
+ total_debits:
+ type: integer
+ description: 支出总金额(AUD分)
+ total_surcharge:
+ type: integer
+ description: 手续费总额(AUD分)
+ total_transfer:
+ type: integer
+ description: 打款总额(AUD分)
+ transactions:
+ type: array
+ items:
+ $ref: 'components_order.yml#/transactionItem'
+ /notify:
+ post:
+ summary: 到账通知
+ description: |
+ 若订单创建时提供了notify_url,系统会在用户支付成功后向这个地址主动发送支付成功状态推送,请求方式为POST
+ 与服务器API不同,推送校验参数会包含在json内,商户系统应该验证校验参数,确定来源正确后再次进行订单接口查询确认订单支付状态再进行后续操作。
+ 商户系统收到请求后应按要求返回参数,若RoyalPay未收到合法参数,视为商户未接收成功,推送动作首次触发会重试3次,随后24小时内每10分钟推送一次,直到返回200状态码。
+ 商户系统应当能够处理收到的重复请求。
+ 商户系统收到通知后以防万一应调用主动查询接口确认订单状态。
+ tags:
+ - SDK Payment
+ - CB Bank
+ - RetailPay
+ - AlipayOnline
+ - CardPayment
+ - MiniProgram
+ - MobileH5
+ - JSAPI
+ - QRCode
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ time:
+ type: integer
+ format: int64
+ description: UTC时间戳
+ nonce_str:
+ type: string
+ description: 随机字符串
+ sign:
+ type: string
+ description: 签名
+ partner_order_id:
+ type: string
+ description: 商户单号
+ channel_order_id:
+ type: string
+ description: 渠道方交易单号
+ order_id:
+ type: string
+ description: RoyalPay订单号
+ total_fee:
+ type: integer
+ description: 订单金额,单位是最小货币单位
+ real_fee:
+ type: integer
+ description: 支付金额,单位是最小货币单位
+ rate:
+ type: number
+ description: 交易时使用的汇率,1AUD=?CNY
+ currency:
+ type: string
+ description: 币种,AUD
+ channel:
+ type: string
+ description: 交易渠道
+ create_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-MM-dd HH:mm:ss
+ description: 订单创建时间,格式为'yyyy-MM-dd HH:mm:ss',GMT+10
+ pay_time:
+ type: string
+ format: 'date-time'
+ pattern: yyyy-MM-dd HH:mm:ss
+ description: 订单支付时间,格式为'yyyy-MM-dd HH:mm:ss',GMT+10
+ responses:
+ 200:
+ description: OK
+ /customs/partners/{partner_code}/declare/report/{client_report_id}:
+ put:
+ summary: 创建报关单
+ tags:
+ - Custom
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: client_report_id
+ in: path
+ required: true
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ order_id:
+ type: string
+ description: 商户支付订单号,要求同一商户唯一
+ custom:
+ type: string
+ description: 海关编号 * [渠道海关编号](https://www.royalpay.com.au/downloads/CustomsNO.xlsx)
+ mch_custom_id:
+ type: string
+ description: 商户在海关备案的编号
+ mch_custom_name:
+ type: string
+ description: 商户海关备案名称
+ sub_order:
+ type: array
+ description: 子订单(拆单)
+ items:
+ type: object
+ properties:
+ sub_order_no:
+ type: string
+ description: 商户子订单号
+ fee_type:
+ type: string
+ description: 币种代码
+ default: CNY
+ enum:
+ - CNY
+ order_fee:
+ type: number
+ description: 子订单金额,单位是元
+ transport_fee:
+ type: number
+ description: 子订单物流金额,单位是元
+ responses:
+ 200:
+ description: Custom
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/customInfo'
+ get:
+ summary: 查询报关单
+ tags:
+ - Custom
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: client_report_id
+ in: path
+ required: true
+ responses:
+ 200:
+ description: Custom
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/customInfo'
+ /customs/partners/{partner_code}/redeclare/report/{client_report_id}:
+ put:
+ summary: 重新提交报关单
+ description: 用于重新提交未报关成功的报关单
+ tags:
+ - Custom
+ parameters:
+ - name: partner_code
+ in: path
+ required: true
+ - name: client_report_id
+ in: path
+ required: true
+ responses:
+ 200:
+ description: Custom
+ content:
+ application/json:
+ schema:
+ $ref: 'components_order.yml#/customInfo'
+components:
+ securitySchemes:
+ nonce_str:
+ type: apiKey
+ in: query
+ name: nonce_str
+ description: 随机字符串
+ time:
+ type: apiKey
+ in: query
+ name: time
+ description: 带毫秒的Unix时间戳,务必检查服务器时间和时区配置。计算服务器上的UTC时间是否匹配真实UTC时间即可。允许误差±5分钟
+ sign:
+ type: apiKey
+ in: query
+ name: sign
+ description: |
+ 商户签约后会分配得到一个partner_code和credential_code用于签名,其中partner_code随请求传递,credential_code务必自行存储不得外泄,仅作为签名参数。
+
+ 每次请求都必须加入签名信息作为请求校验。校验参数全部以Query Param参数的方式附加在URL后面,顺序不分先后。
+
+ 签名过程:
+
+ 1. 连接生成签名的原始字符串,需要4个参数,使用&连接,无需转码
+ > valid_string=partner_code&time&nonce_str&credential_code
+
+ 2. 使用SHA256对valid_string进行签名,并转换为小写字符串
+ > sign=hex(sha256(valid_string)).toLowerCase()
+
+ 3. 在请求中将签名使用的time, nonce_str和生成的sign作为query参数发送
+
+ > 签名测试地址:https://mpay.royalpay.com.au/sign_test.html
+
+
diff --git a/src/document/tpl/img/JSAPI_process_en.png b/src/document/openapi/en/img/JSAPI_process_en.png
similarity index 100%
rename from src/document/tpl/img/JSAPI_process_en.png
rename to src/document/openapi/en/img/JSAPI_process_en.png
diff --git a/src/document/tpl/img/QRCODE_process_en.png b/src/document/openapi/en/img/QRCODE_process_en.png
similarity index 100%
rename from src/document/tpl/img/QRCODE_process_en.png
rename to src/document/openapi/en/img/QRCODE_process_en.png
diff --git a/src/document/tpl/img/RetailQR_en.png b/src/document/openapi/en/img/RetailQR_en.png
similarity index 100%
rename from src/document/tpl/img/RetailQR_en.png
rename to src/document/openapi/en/img/RetailQR_en.png
diff --git a/src/document/tpl/img/Retail_en.png b/src/document/openapi/en/img/Retail_en.png
similarity index 100%
rename from src/document/tpl/img/Retail_en.png
rename to src/document/openapi/en/img/Retail_en.png
diff --git a/src/document/tpl/img/RoyalPay_Gateway_choose_en.jpg b/src/document/openapi/en/img/RoyalPay_Gateway_choose_en.jpg
similarity index 100%
rename from src/document/tpl/img/RoyalPay_Gateway_choose_en.jpg
rename to src/document/openapi/en/img/RoyalPay_Gateway_choose_en.jpg
diff --git a/src/document/tpl/img/alipayOnline_en.png b/src/document/openapi/en/img/alipayOnline_en.png
similarity index 100%
rename from src/document/tpl/img/alipayOnline_en.png
rename to src/document/openapi/en/img/alipayOnline_en.png
diff --git a/src/document/tpl/img/jd_en.png b/src/document/openapi/en/img/jd_en.png
similarity index 100%
rename from src/document/tpl/img/jd_en.png
rename to src/document/openapi/en/img/jd_en.png
diff --git a/src/document/openapi/en/img/logo_new.jpg b/src/document/openapi/en/img/logo_new.jpg
new file mode 100644
index 000000000..41c02602a
Binary files /dev/null and b/src/document/openapi/en/img/logo_new.jpg differ
diff --git a/src/document/tpl/img/microapp_en.png b/src/document/openapi/en/img/microapp_en.png
similarity index 100%
rename from src/document/tpl/img/microapp_en.png
rename to src/document/openapi/en/img/microapp_en.png
diff --git a/src/document/openapi/en/img/rp_logo.svg b/src/document/openapi/en/img/rp_logo.svg
new file mode 100644
index 000000000..d57a76e21
--- /dev/null
+++ b/src/document/openapi/en/img/rp_logo.svg
@@ -0,0 +1,58 @@
+
+
+
+
diff --git a/src/document/tpl/img/sdk_wechat_api_payment_en.png b/src/document/openapi/en/img/sdk_wechat_api_payment_en.png
similarity index 100%
rename from src/document/tpl/img/sdk_wechat_api_payment_en.png
rename to src/document/openapi/en/img/sdk_wechat_api_payment_en.png
diff --git a/src/document/openapi/en/index.html b/src/document/openapi/en/index.html
new file mode 100644
index 000000000..6b6d61ff8
--- /dev/null
+++ b/src/document/openapi/en/index.html
@@ -0,0 +1,23 @@
+
+
+
+
+ RoyalPay Document
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/document/tpl/resources/api/AlipaySDKForiOS.zip b/src/document/openapi/resources/api/AlipaySDKForiOS.zip
similarity index 100%
rename from src/document/tpl/resources/api/AlipaySDKForiOS.zip
rename to src/document/openapi/resources/api/AlipaySDKForiOS.zip
diff --git a/src/document/tpl/resources/api/alipaySdk-20160825.jar b/src/document/openapi/resources/api/alipaySdk-20160825.jar
similarity index 100%
rename from src/document/tpl/resources/api/alipaySdk-20160825.jar
rename to src/document/openapi/resources/api/alipaySdk-20160825.jar
diff --git a/src/document/tpl/img/logo_new.jpg b/src/document/tpl/img/logo_new.jpg
deleted file mode 100644
index 7b51acf46..000000000
Binary files a/src/document/tpl/img/logo_new.jpg and /dev/null differ