Как сделать оплату квадратом из кода Дарт в флаттере? - PullRequest
0 голосов
/ 15 мая 2019

Мне нужно совершать платежи с квадратом, я использовал плагин square_in_app_payments, но он только дает мне лишнюю строку, которая, кажется, мне нужно отправить в api checkout с информацией о товарах внутри JSON в запросе http, но я не понимаю, как сделатьit.

Я только пытался от почтальона сделать несколько образцов для квадрата.

POST /v2/locations/{{location_id}}/checkouts HTTP/1.1
Host: connect.squareup.com
Authorization: Bearer {{access_token}}
Content-Type: application/json
cache-control: no-cache
Postman-Token: 5d2c05ae-11d6-42bd-bd1e-47fa44621a98

{
  "idempotency_key": "60f919ba-2042-4402-bc66-e6455ec32349",
  "order": {
    "reference_id": "reference_id",
    "line_items": [
      {
        "name": "Printed T Shirt",
        "quantity": "2",
        "base_price_money": {
          "amount": 1500,
          "currency": "USD"
        },
        "discounts": [
          {
            "name": "7% off previous season item",
            "percentage": "7"
          },
          {
            "name": "$3 off Customer Discount",
            "amount_money": {
              "amount": 300,
              "currency": "USD"
            }
          }
        ]
      },
      {
        "name": "Slim Jeans",
        "quantity": "1",
        "base_price_money": {
          "amount": 2500,
          "currency": "USD"
        }
      },
      {
        "name": "Woven Sweater",
        "quantity": "3",
        "base_price_money": {
          "amount": 3500,
          "currency": "USD"
        },
        "discounts": [
          {
            "name": "$11 off Customer Discount",
            "amount_money": {
              "amount": 1100,
              "currency": "USD"
            }
          }
        ],
        "taxes": [
          {
            "name": "Fair Trade Tax",
            "percentage": "5"
          }
        ]
      }
    ],
    "discounts": [
      {
        "name": "Father's day 12% OFF",
        "percentage": "12"
      },
      {
        "name": "Global Sales $55 OFF",
        "amount_money": {
          "amount": 5500,
          "currency": "USD"
        }
      }
    ],
    "taxes": [
      {
        "name": "Sales Tax",
        "percentage": "8.5"
      }
    ]
  },
  "ask_for_shipping_address": true,
  "merchant_support_email": "merchant+support@website.com",
  "pre_populate_buyer_email": "example@email.com",
  "pre_populate_shipping_address": {
    "address_line_1": "1455 Market St.",
    "address_line_2": "Suite 600",
    "locality": "San Francisco",
    "administrative_district_level_1": "CA",
    "postal_code": "94103",
    "country": "US",
    "first_name": "Jane",
    "last_name": "Doe"
  }
}

Мне нужно знать, как взять строку nonce из формы карты плагина square_in_app_payments и отправить ее в запросе httpдля полной оплаты.

...