Skip to main content
POST
/
v2
/
payments
/
open
/
api
/
pay
消费
curl --request POST \
  --url https://gate.uat.payloco.com/gateway/v2/payments/open/api/pay \
  --header 'Content-Type: application/json' \
  --header 'signature: <api-key>' \
  --data '
{
  "charset": "UTF-8",
  "version": "2.0.0",
  "signType": "RSA",
  "memberId": "2023010558663764",
  "merchantId": "2023010558663764",
  "requestTime": "2024-05-24T14:29:32.682+08:00",
  "keyVersion": "1",
  "data": {
    "merchantOrderId": "ORD202604231532478921",
    "integrate": "Direct",
    "captureMode": "MANUAL",
    "subject": "Iphone 16",
    "totalAmount": 10.01,
    "currency": "USD",
    "country": "US",
    "userId": "U123333333",
    "expireTime": "1800",
    "paymentDetail": {
      "paymentMethodType": "WALLET",
      "targetOrg": "KLARNA",
      "payAccountInfo": [
        {
          "accountNo": "12345567777789",
          "accountNoType": "EMAIL"
        }
      ],
      "cardInfo": {
        "cardNo": "4111111111111111",
        "cardlName": "John Tan",
        "cardExpirationMonth": "12",
        "cardExpirationYear": "28",
        "cvv": "123",
        "stored": "true",
        "dynamic3DS": "true"
      },
      "buyerInfo": {
        "firstName": "John",
        "middleName": "Michael",
        "email": "john.tan@example.com",
        "lastName": "Tan",
        "phoneNo": "+6591234567",
        "phoneNoRegion": "+65",
        "idType": "PASSPORT",
        "idNo": "E12345678",
        "taxType": "CPF",
        "taxNo": "123.456.789-09",
        "address": "10 Anson Road, #25-08 International Plaza",
        "city": "Singapore",
        "region": "Central",
        "zipCode": "079903",
        "clientIp": "203.0.113.42",
        "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15"
      },
      "paymentTokenID": "ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a",
      "tokenForFutureUse": true,
      "merchantInitiated": "false",
      "mitType": "SCHEDULED",
      "info3DSecure": {
        "threeDSVersion": "2.2.0",
        "eci": "05",
        "cavv": "AAABBBCCCDDDEEE111222333",
        "dsTransactionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
        "xid": "MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=="
      },
      "carrierId": "qiye"
    },
    "goodsDetails": [
      {
        "goodsId": "SKU_1000001",
        "goodsName": "Wireless Bluetooth Earbuds",
        "quantity": "2",
        "price": "59.99",
        "goodsCurrency": "USD",
        "showUrl": "https://example.com/product/sku_1000001",
        "goodsCategory": "Electronics"
      }
    ],
    "subMerchant": {
      "subMerchantNo": "SM202604270001"
    },
    "shippingInfo": {
      "firstName": "John",
      "middleName": "string",
      "lastName": "John",
      "phoneNo": "+6598765432",
      "email": "john.tan@example.com",
      "address1": "10 Anson Road",
      "city": "Singapore",
      "region": "Central",
      "state": "string",
      "country": "SG",
      "zipCode": "079903",
      "address2": "#25-08 International Plaza",
      "address3": "string"
    },
    "billingInfo": {
      "firstName": "John",
      "middleName": "Michael",
      "lastName": "Tan",
      "phoneNo": "+6591234567",
      "email": "john.tan@example.com",
      "address1": "10 Anson Road",
      "city": "Singapore",
      "country": "SG",
      "region": "Central",
      "state": "string",
      "zipCode": "079903",
      "address2": "#25-08 International Plaza",
      "address3": "string"
    },
    "envInfo": {
      "deviceId": "a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f",
      "deviceLanguage": "en-US",
      "screenHeight": "956",
      "screenWidth": "440",
      "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
    },
    "language": "EN",
    "riskParams": {},
    "terminalType": "APP",
    "osType": "ANDROID",
    "reference": "goods reference",
    "frontCallbackUrl": "https://www.google.com",
    "notifyUrl": "https://www.google.com",
    "subscriptionPlan": {
      "subscriptionNo": "SUB_202604270001"
    }
  }
}
'
{
  "code": "00000003",
  "message": "处理中",
  "traceId": "33fae7b7aed1233f",
  "data": {
    "status": "SUCCESS",
    "merchantId": "2023010558663764",
    "merchantOrderId": "167812677182888888",
    "orderId": "TR1658354573473091584",
    "currency": "USD",
    "totalAmount": 10.01,
    "nextAction": {
      "contentType": "application/json",
      "data": {},
      "method": "GET",
      "qrcode": "weixin://wxpay/bizpayurl?pr=waUjCuPzz",
      "type": "render_qrcode",
      "url": "https://www.google.com"
    }
  }
}

Authorizations

signature
string
header
required

加签(Signature)

加签是 PayLoco 开放平台与商户之间用于保障报文完整性防篡改的安全机制。

适用场景

  1. 商户请求 PayLoco:商户使用自身私钥对请求报文进行加签。
  2. PayLoco 返回响应:商户使用 PayLoco 公钥 对响应报文进行验签。

加签规则(商户请求端)

商户需对 HTTP 请求的 Body 进行签名,具体步骤如下:

1. 计算签名(SHA256withRSA)

Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(merchantPrivateKey);

// 必须使用 UTF-8 编码
byte[] bodyBytes = requestBody.getBytes(StandardCharsets.UTF_8);
signature.update(bodyBytes);

byte[] signedBytes = signature.sign();

2. 将加签内容进行 Base64 编码;

String signature = Base64.getEncoder().encodeToString(signedHash);

3. 将编码后的内容放在请求头部 signature 参数中。

POST /v2/payments/open/api/pay HTTP/1.1
Content-Type: application/json
signature: MIIC8jCCAdqgAwIBAgI...

Headers

signature
string
required

签名

Example:

"FPFVT3o227JrFRbqu19boZCpVVTF9KznxyRawUmxpfXilHV/0yK46haPhAjNu1hPUMy7Vw/ILXhfzffNm4Fj0apWknlTY9OJxnSoQxS9BTFtc61tn5yV1q69x/kkBl82/qwg+XTJ4fOzy7Mar3VaC1E2PlDA6RkkKBUyNE6RYgsdB+Su7an4+4HVTNAnoe74WyvBgxTLMNg28igBTdqxaO3w/UBY6ObVp7vkqkQGdL1Y+HgmMYaAVwrM3+ALWGId0sJ+YqTY4WJ+0xCRGhaSnybiIjZsQEYyID68WNUfuavDLDsEhaMm/HfQvf5p0R1Ltovp3wwJnEbQcjY458iX5A=="

Body

application/json
charset
string
default:UTF-8
required

交互数据的编码【utf-8】

Example:

"UTF-8"

version
string
required

接口版本,当前版本为【2.0.0】,目前只能传2.0.0,不能不传

Maximum string length: 8
Example:

"2.0.0"

signType
string
required

报文签名类型

Example:

"RSA"

memberId
string
required

机构号

Example:

"2023010558663764"

merchantId
string
required

商户号

Maximum string length: 32
Example:

"2023010558663764"

requestTime
string
required

请求时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ssSSS+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2026-05-20T13:29:35.262+08:00表示,北京时间2026年5月20日13点29分35秒。

Maximum string length: 32
Example:

"2026-05-24T14:29:32.682+08:00"

keyVersion
string
required

密钥版本 当前值为:1

Maximum string length: 8
Example:

"1"

data
object

请求数据体

Response

200 - application/json

OK

code
string
required

响应状态码,code为00000000表示响应成功,其他状态码表示响应失败。具体系统错误码可以参考系统错误码。

Example:

"00000003"

message
string
required

错误消息

Example:

"处理中"

traceId
string
required

请求消息唯一标识。traceId为本次调用产生的流水号,接口调用异常,可以提供此流水号用于排查问题。

Example:

"33fae7b7aed1233f"

data
object