> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paymentoptions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ホスト型決済ページ

> 取引をキャプチャするためのホスト型決済ページ（HPP）を開くリンクを生成します。

### 重要なポイント

<Info>
  * ペイロードにデータ（例：金額、通貨、顧客詳細、return\_url、決済方法）が事前入力されている場合、これらの詳細はHPPに反映され、スムーズなユーザー体験を提供します。

  * ペイロードに必要なデータが欠けている場合、顧客はHPPで不足している情報を手動で入力する必要があります。

  * 必要なヘッダーと認証詳細が含まれていることを確認し、HPPリンクを正常に生成します。
</Info>

## フローダイアグラム

<img src="https://mintcdn.com/dasdoc/kfo25CLU3J6KbVVp/images/timeline-diagram/flows-API-HPP-jp.svg?fit=max&auto=format&n=kfo25CLU3J6KbVVp&q=85&s=6a63da0fe3a2c5375774818d7d7532b5" alt="Flow diagram image" width="1997" height="1150" data-path="images/timeline-diagram/flows-API-HPP-jp.svg" />

## ApplePay & GooglePay

加盟店がApple PayおよびGoogle Payに対応している場合、ホスト型決済ページ（HPP）にはGoogle PayおよびApple Payのボタンが表示され、顧客はこれらの方法で支払いを完了できます。

### 重要なポイント

<Info>
  加盟店の設定

  Apple PayまたはGoogle Payのいずれかの加盟店IDを、決済リンクを生成するリクエストの際にHPPペイロードに含める必要があります。

  加盟店が正しく設定されている場合、これらの決済方法は自動的にHPPに表示されます。

  決済ボタン

  HPPは、加盟店のアカウントの利用可能性と設定に基づいて、Google PayおよびApple Payのボタンを動的に表示します。

  顧客は、どちらかの方法をシームレスに使用して、HPPから直接取引を完了できます。

  同じ加盟店（つまり、同一のDAS MID）に対してApple PayとGoogle Payの両方が設定されている場合、以下のオプションパラメーターをHPPペイロードに含めることで、表示するボタンの優先順位を制御できます:

  <pre>
    <code>
      {`"buttons": {
              "enable_googlepay": true
            }`}
    </code>
  </pre>

  この値を true に設定すると、決済画面上でGoogle Payが優先的に表示されます。省略された場合は、デバイスおよびブラウザの互換性に基づいてデフォルトの優先順位が適用されます。
</Info>

## APIパラメータ


## OpenAPI

````yaml api-reference/jp/open-api-config/hpp/generate-link.json POST /api/v1/server-to-server-interface/hpp/generate/link
openapi: 3.0.1
info:
  title: Payment Options API
  description: ホスト型決済ページ（HPP）リンクの生成と決済処理のためのAPI
  version: 1.0.0
servers:
  - url: https://api-dev.paymentoptions.com
security:
  - apiKeyAuth: []
    xApiKeyAuth: []
paths:
  /api/v1/server-to-server-interface/hpp/generate/link:
    post:
      summary: HPPリンクを生成
      description: このエンドポイントは、ホスト型決済ページ（HPP）リンクを生成するためのものです。
      operationId: generateHppLink
      requestBody:
        description: HPPリンクを生成するためのリクエストペイロード
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                return_url:
                  type: object
                  additionalProperties: false
                  description: リターンURLを含むJSONオブジェクト
                  properties:
                    webhook_url:
                      type: string
                      description: 非同期通知用のWebhook URL
                      maxLength: 255
                      example: < Webhook url >
                    success_url:
                      type: string
                      description: 決済成功後にユーザーをリダイレクトするURL
                      maxLength: 255
                      example: http://www.successurl.com/
                    decline_url:
                      type: string
                      description: 決済失敗後にユーザーをリダイレクトするURL
                      maxLength: 255
                      example: http://www.declineurl.com/
                    cancel_url:
                      type: string
                      description: 決済がキャンセルされた場合にユーザーをリダイレクトするURL
                      maxLength: 255
                      example: http://cancelurl.com/
                amount:
                  type: number
                  description: 取引の金額
                  example: 1000
                currency:
                  type: string
                  description: 処理通貨（例：JPY）
                  maxLength: 3
                  example: JPY
                merchant_id:
                  type: string
                  description: 加盟店ID（DASMID）
                  maxLength: 128
                  example: < Merchant ID >
                merchant_email:
                  type: string
                  description: 加盟店のメールアドレス
                  maxLength: 45
                  example: merchant@testemail.com
                merchant_txn_ref:
                  type: string
                  description: 加盟店の取引参照ID
                  maxLength: 45
                  example: 2003089893366DTEST
                billing_address:
                  type: object
                  additionalProperties: false
                  description: カード所有者の請求先住所を含むJSONオブジェクト
                  properties:
                    country:
                      type: string
                      description: カード所有者の請求先国コード
                      maxLength: 2
                      example: JP
                    email:
                      type: string
                      description: カード所有者の請求先メールアドレス
                      maxLength: 45
                      example: billing@testemail.com
                    phone_number:
                      type: string
                      description: カード所有者の請求先電話番号
                      maxLength: 15
                      example: '8112345678'
                    address1:
                      type: string
                      description: カード所有者の請求先住所の詳細
                      maxLength: 199
                      example: 1-2-3 Shinjuku
                    city:
                      type: string
                      description: カード所有者の請求先都市
                      maxLength: 65
                      example: Shinjuku-ku
                    state:
                      type: string
                      description: カード所有者の請求先都道府県
                      maxLength: 65
                      example: Tokyo
                    postal_code:
                      type: string
                      description: カード所有者の請求先郵便番号
                      maxLength: 45
                      example: '1600022'
                shipping_address:
                  type: object
                  additionalProperties: false
                  description: カード所有者の配送先住所を含むJSONオブジェクト
                  properties:
                    country:
                      type: string
                      description: カード所有者の配送先国コード
                      maxLength: 2
                      example: JP
                    email:
                      type: string
                      description: カード所有者の配送先メールアドレス
                      maxLength: 45
                      example: shipping@testemail.com
                    phone_number:
                      type: string
                      description: カード所有者の配送先電話番号
                      maxLength: 20
                      example: '8112345678'
                    address1:
                      type: string
                      description: カード所有者の配送先住所の詳細
                      maxLength: 199
                      example: 1-2-3 Shinjuku
                    city:
                      type: string
                      description: カード所有者の配送先都市
                      maxLength: 65
                      example: Shinjuku-ku
                    state:
                      type: string
                      description: カード所有者の配送先都道府県
                      maxLength: 65
                      example: Tokyo
                    postal_code:
                      type: string
                      description: カード所有者の配送先郵便番号
                      maxLength: 45
                      example: '1600022'
              required:
                - return_url
                - currency
                - merchant_id
                - merchant_email
                - payment_method
                - billing_address
      responses:
        '200':
          description: HPPリンクが正常に生成されました
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 取引参照ID
                    example: f49173ce-4916-445c-a831-3c1468acf14e
                  url:
                    type: string
                    description: 生成されたホスト型決済ページのURLリンク
                    example: >-
                      https://checkout-dev.paymentoptions.com/jp/HostedPaymentPage/hKJsdByR
                  amount:
                    type: number
                    description: 取引の金額
                    example: 1000
                  currency:
                    type: string
                    description: 取引の処理通貨
                    example: JPY
                  merchant_txn_ref:
                    type: string
                    description: 加盟店の取引参照ID
                    example: 2003089893366DTEST
                  merchant_id:
                    type: string
                    description: 実行された取引のDAS加盟店ID
                    example: < Merchant ID >
                  merchant_email:
                    type: string
                    description: 加盟店のメールアドレス
                    example: merchant@testemail.com
                  return_url:
                    type: object
                    additionalProperties: false
                    description: リターンURLを含むJSONオブジェクト
                    properties:
                      webhook_url:
                        type: string
                        description: 非同期通知用のWebhook URL
                        example: < Webhook url >
                      success_url:
                        type: string
                        description: 決済成功後にユーザーをリダイレクトするURL
                        example: http://www.successurl.com/
                      decline_url:
                        type: string
                        description: 決済失敗後にユーザーをリダイレクトするURL
                        example: http://www.declineurl.com/
                      cancel_url:
                        type: string
                        description: 決済がキャンセルされた場合にユーザーをリダイレクトするURL
                        example: http://cancelurl.com/
                  billing_address:
                    type: object
                    additionalProperties: false
                    description: カード所有者の請求先住所を含むJSONオブジェクト
                    properties:
                      city:
                        type: string
                        description: カード所有者の請求先都市
                        example: Shinjuku-ku
                      email:
                        type: string
                        description: カード所有者の請求先メールアドレス
                        example: billing@testemail.com
                      phone_number:
                        type: string
                        description: カード所有者の請求先電話番号
                        example: '8112345678'
                      state:
                        type: string
                        description: カード所有者の請求先都道府県
                        example: Tokyo
                      country:
                        type: string
                        description: カード所有者の請求先国コード
                        example: JP
                      address1:
                        type: string
                        description: カード所有者の請求先住所の詳細
                        example: 1-2-3 Shinjuku
                      postal_code:
                        type: string
                        description: カード所有者の請求先郵便番号
                        example: '1600022'
                  shipping_address:
                    type: object
                    additionalProperties: false
                    description: カード所有者の配送先住所を含むJSONオブジェクト
                    properties:
                      city:
                        type: string
                        description: カード所有者の配送先都市
                        example: Shinjuku-ku
                      email:
                        type: string
                        description: カード所有者の配送先メールアドレス
                        example: shipping@testemail.com
                      phone_number:
                        type: string
                        description: カード所有者の配送先電話番号
                        example: '8112345678'
                      state:
                        type: string
                        description: カード所有者の配送先都道府県
                        example: Tokyo
                      country:
                        type: string
                        description: カード所有者の配送先国コード
                        example: JP
                      address1:
                        type: string
                        description: カード所有者の配送先住所の詳細
                        example: 1-2-3 Shinjuku
                      postal_code:
                        type: string
                        description: カード所有者の配送先郵便番号
                        example: '1600022'
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
      description: 認証のためのAPIキー。形式：'Basic YOUR_API_KEY_HERE'
    xApiKeyAuth:
      type: apiKey
      name: x-api-key
      in: header
      description: x-api-key専用のAPIキー

````