メインコンテンツへスキップ
このページで

API経由で、Mercado Pagoをアプリケーションに統合します。

1. 注文を作成#

購入するには、DEUNAで注文を作成します。

V2の「Purchase」エンドポイントへのリクエストを送信してください。 注文の作成 endpoint.

API は、 order_token を返します。

リクエスト例

JSON
{
    "order_type": "AIRLINE_ORDER",
    "order": {
        ....
        "statement_descriptor": "DEUNA_TICKET",
        "store_code": "all",
        "airline_information": {
            "booking_items": [
                {
                    "passenger": {
                        "first_name": "Jhon",
                        "middle_name": "Paul",
                        "last_name": "Smith",
                        "date_of_birth": "2000-06-27"
                    },
                    "legs": [
                        {
                            "carrier_name": "Aeromexico",
                            "sub_total_amount": 900,
                            "tax_amount": 600,
                            "total_amount": 1500,
                            "origin": {
                                "date": "2020-02-15",
                                "time": "15:30",
                                "iata_code": "SFO"
                            },
                            "destination": {
                                "iata_code": "DBX",
                                "date": "2020-02-15",
                                "time": "15:30"
                            }
                        }
                    ]
                }
            ]
        }
    }
}

フィールドの説明

API経由で、Mercado Pagoの注文に必要なすべてのフィールドを埋める方法を学習します。

すべての注文で共通のフィールド:

フィールドパス説明例
order_type注文の種類 (航空会社の情報がある場合は、AIRLINE_ORDERである必要があります)AIRLINE_ORDER
order.statement_descriptor支払いに関するステートメント。 Mercado Pagoで受け入れられる最大文字数: 13文字。DEUNA*SHOP123

必要となる乗客のフィールド

各乗客について、個人情報を入力し、購入されたフライトをそれぞれ入力します。

フィールドパス説明例必須
order.airline_information.booking_items[0].passenger.first_name乗客の姓John
order.airline_information.booking_items[0].passenger.middle_name乗客のミドルネーム(該当する場合)Paul任意
order.airline_information.booking_items[0].passenger.last_name乗客の姓Smith
order.airline_information.booking_items[0].passenger.date_of_birth乗客の生年月日2000-06-27任意
order.airline_information.booking_items[0].legs[0].carrier_name航空会社コードAeroméxicoデフォルト値 "Unknown"
order.airline_information.booking_items[0].legs[0].total_amountフライトの合計金額1000
order.airline_information.booking_items[0].legs[0].sub_total_amount税抜き合計金額1000
order.airline_information.booking_items[0].legs[0].tax_amount税額0任意
order.airline_information.booking_items[0].legs[0].origin.date出発日2020-02-15
order.airline_information.booking_items[0].legs[0].origin.time出発時間15:30
order.airline_information.booking_items[0].legs[0].origin.iata_code出発空港のIATAコードSFOデフォルト値 "N/A”
order.airline_information.booking_items[0].legs[0].destination.iata_code目的地空港のIATAコードDBXデフォルト値 "N/A”
order.airline_information.booking_items[0].legs[0].destination.date宛先の日付2020-02-15
order.airline_information.booking_items[0].legs[0].destination.time到着時間15:30

注文フィールド

フィールド説明例必須
order.store_code一意なストアコード (値: "all")all
order.items商品の収集。確認注文の作成 航空会社情報が含まれていない場合、このメルカド パゴ フローで必須です。
order.statement_descriptor支払いに関するステートメント。 Mercado Pagoで受け入れられる最大文字数: 13文字。DEUNA\SHOP123

一般的な考慮事項:

  • Acerca de order.items:
    • total_amount.original_amount debe ser unit_price.amount * quantity.
    • total_amount.amount debe ser ((unit_price.amount + tax_amount.amount) * quantity) - total_amount.total_discount.
    • total_amount.total_discount es el valor total de los descuentos para la cantidad de artículos.
  • order.items_total_amount これは、商品の単価の合計です。この金額に加えて、 order.total_tax_amount およびマイナス order.discount_amountが一致する必要があります order.total_amount.
  • order.sub_total これは、商品の単価から割引を差し引いた金額です。この金額に加えて、 order.total_tax_amountが一致する必要があります order.total_amount.

Mercado Pago がネイティブブラウザ環境 (SafariViewController iOS または Custom Tabs Android 上)、支払い結果をアプリに戻すように、深層リンクを設定する必要があります。

JSON
{
    "order_type": "AIRLINE_ORDER",
    "order": {
		.
		.
		.
        "callback_urls": {
            "on_success": "yourapp://success",
            "on_pending": "yourapp://pending",
            "on_failed": "yourapp://failed"
        }
    }
}

3. 注文の処理#

V2の「Purchase」エンドポイントへのリクエストを送信してください。 V2 Purchase エンドポイントで支払い処理を行います。