Translation disclaimer

Documentation is written in English and subsequently translated. This page, therefore, might not have the most up-to-date content. If any questions arise relating to the accuracy of the translated content, please refer to the English version of the page.

Menu

开始使用 Payments API

让自己熟悉我们的API 原则,以确保有弹性的集成。


设置头文件

设置头文件是 API 请求的重要组成部分。头文件代表与您的 API 请求相关的元数据。

Copied!
Authorization: {your_credentials}
Content-Type: application/vnd.worldpay.payments-v6+json
Accept: application/vnd.worldpay.payments-v6.hal+json
头文件模式
Authorization我们在 Access Worldpay 中使用 Authorization 头文件来识别您并进行身份验证。除非您在 TLS 上使用了客户端证书身份验证,否则您必须对发送到我们 Payments API 的任何请求使用 Authorization 头文件。如果您必须使用此功能,请阅读关于通过 SSL/TLS 进行身份验证的参考指南。
Content-Type如果您发送的请求中包含请求正文,并且 HTTP 方法是 POSTPUT,则我们要求使用 Content-Type 头文件。
Accept我们使用 Accept 头文件来识别您正在使用哪个版本的 Payments API。您必须对发送给 Payments API 的任何请求使用 Accept 头文件。

注释:用您 base64 编码的 Basic Auth(基本授权)用户名和密码替换“{your_credentials}”。若要获得 Access Worldpay 登录凭证,请联系您的实施经理。

查询根资源

我们的 API 可提供指向后续可用操作的链接,以便为您提供指导。

要探索并开始使用我们的 API,您必须首先查询根资源。这样就会返回 Access Worldpay 中的可用资源。

请求

GET https://try.access.worldpay.com/

注释:该请求不需要请求正文。

响应

您会在响应中收到所有我们可用的 API 资源。

Copied!
{
  "_links": {
    "payments:authorize": {
      "href": "https://try.access.worldpay.com/payments/authorizations"
    },
    "service:payments": {
      "href": "https://try.access.worldpay.com/payments"
    },
    "service:sessions": {
      "href": "https://try.access.worldpay.com/sessions"
    },
    "service:tokens": {
      "href": "https://try.access.worldpay.com/tokens"
    },
    "service:verifications/accounts": {
      "href": "https://try.access.worldpay.com/verifications/accounts"
    },
    "service:verifications/customers/3ds": {
      "href": "https://try.access.worldpay.com/verifications/customers/3ds"
    },
    "service:verifiedTokens": {
      "href": "https://try.access.worldpay.com/verifiedTokens"
    },
    "service:fraudsight": {
      "href": "https://try.access.worldpay.com/fraudsight"
    },
    "service:exemptions": {
      "href": "https://try.access.worldpay.com/exemptions"
    },
    "service:payouts": {
      "href": "https://try.access.worldpay.com/payouts"
    },
    "service:payments/alternative/direct": {
      "href": "https://try.access.worldpay.com/payments/alternative/direct"
    },
    "service:payments/alternative/action/paypal": {
      "href": "https://try.access.worldpay.com/payments/alternative/action/paypal"
    },
    "service:payments/alternative/action/ideal": {
      "href": "https://try.access.worldpay.com/payments/alternative/action/ideal"
    },
    "service:payouts/accounts": {
      "href": "https://try.access.worldpay.com/payouts/accounts"
    },
    "service:payouts/events": {
      "href": "https://try.access.worldpay.com/payouts/events"
    },
    "service:moneyTransfers": {
      "href": "https://try.access.worldpay.com/moneyTransfers"
    },
    "service:foreignExchange": {
      "href": "https://try.access.worldpay.com/foreignExchange"
    },
    "service:accounts/statements": {
      "href": "https://try.access.worldpay.com/accounts/statements"
    },
    "service:accounts/balance": {
      "href": "https://try.access.worldpay.com/accounts/balance"
    },
    "service:accounts/transfer": {
      "href": "https://try.access.worldpay.com/accounts/transfer"
    },
    "curies": [
      {
        "href": "https://try.access.worldpay.com/rels/payments/{rel}",
        "name": "payments",
        "templated": true
      }
    ]
  }
}

查询支付根资源

查询 service:payments 资源,它会为您提供 Payments API 的后续可用操作的链接和资源。

请求

GET https://try.access.worldpay.com/payments

注释:该请求不需要请求正文。

响应

Copied!
{
    "_links": {
        "resourceTree": {
            "href": "https://try.access.worldpay.com/payments/resourceTree"
        },
        "payments:authorize": {
            "href": "https://try.access.worldpay.com/payments/authorizations"
        },
        "payments:cardOnFileAuthorize": {
            "href": "https://try.access.worldpay.com/payments/authorizations/cardOnFile"
        },
        "payments:migrateRecurringAuthorize": {
            "href": "https://try.access.worldpay.com/payments/authorizations/migrateRecurring"
        },
        "payments:migrateCardOnFileAuthorize": {
            "href": "https://try.access.worldpay.com/payments/authorizations/migrateCardOnFile"
        },
        "payments:migrateCardOnFileSale": {
            "href": "https://try.access.worldpay.com/payments/sales/migrateCardOnFile"
        },
        "payments:events": {
            "href": "https://try.access.worldpay.com/payments/events"
        },
        "payments:recurringMandate": {
            "href": "https://try.access.worldpay.com/payments/recurringMandates"
        },
        "curies": [
            {
                "name": "payments",
                "href": "https://try.access.worldpay.com/rels/payments/{rel}",
                "templated": true
            }
        ]
    }
}

使用返回的操作链接,将您的请求发送至我们的资源之一。不要对链接进行硬编码 (URI)。

资源

您的支付根资源请求中包含返回的多个资源。下表简要介绍了可用的每种资源。

操作链接(资源)描述
payments:authorize一次性授权支付。
payments:migrateRecurringAuthorize授权并使现有重复性支付协议符合存储的凭证指令。
payments:migrateCardOnFileAuthorize授权并将新的或现有预存卡号协议纳入 Access Worldpay。
payments:migrateCardOnFileSale授权和结算客户发起的预存卡号支付。
payments:recurringMandate您不得向该资源发送请求。该操作链接被我们的Verifications API用于让您的payments:recurringAuthorizepayments:cardOnFileAuthorizepayments:recurringSale请求符合 MIT/ CIT 的规定。

链接缓存

当您在 Access Worldpay 中发出请求时,您应该始终缓存返回的响应。

后续步骤


接受支付