更多 Square Checkout 示例问题 - 没有可用的验证 ID

More Square Checkout Example problems - no verification ID available

Square Checkout API 安装指南示例位于:

https://docs.connect.squareup.com/payments/checkout/setup

表示您需要存储 CheckoutId 以供以后验证。不幸的是,无论谁写了这个例子(除了我在其他地方提到的一些编码错误之外)都没有完成这个例子并提供验证码。如果他们有,他们可能已经看到没有交易 ID 匹配功能。

也许我遗漏了一些东西,但如果您比较结帐对象

object(SquareConnect\Model\CreateCheckoutResponse)#25 (2) {
  ["checkout":protected]=>
  object(SquareConnect\Model\Checkout)#26 (10) {
    ["id":protected]=>
    string(30) "xxxxxxxxxx"
    ["checkout_page_url":protected]=>
    string(106) "removed for security"
    ["ask_for_shipping_address":protected]=>
    bool(false)
    ["merchant_support_email":protected]=>
    NULL
    ["pre_populate_buyer_email":protected]=>
    string(16) "client@email.com"
    ["pre_populate_shipping_address":protected]=>
    NULL
    ["redirect_url":protected]=>
    string(43) "whateverreturn.php"
    ["order":protected]=>
    object(SquareConnect\Model\Order)#27 (7) {
      ["id":protected]=>
      NULL
      ["location_id":protected]=>
      string(30) "xxxxxxxxxx"
      ["reference_id":protected]=>
      NULL
      ["line_items":protected]=>
      array(1) {
        [0]=>
        object(SquareConnect\Model\OrderLineItem)#28 (13) {
          ["name":protected]=>
          string(16) "MyCheckout Title"
          ["quantity":protected]=>
          string(1) "1"
          ["note":protected]=>
          NULL
          ["catalog_object_id":protected]=>
          NULL
          ["variation_name":protected]=>
          NULL
          ["modifiers":protected]=>
          NULL
          ["taxes":protected]=>
          NULL
          ["discounts":protected]=>
          NULL
          ["base_price_money":protected]=>
          object(SquareConnect\Model\Money)#29 (2) {
            ["amount":protected]=>
            int(60000)
            ["currency":protected]=>
            string(3) "USD"
          }
          ["gross_sales_money":protected]=>
          object(SquareConnect\Model\Money)#30 (2) {
            ["amount":protected]=>
            int(60000)
            ["currency":protected]=>
            string(3) "USD"
          }
          ["total_tax_money":protected]=>
          object(SquareConnect\Model\Money)#31 (2) {
            ["amount":protected]=>
            int(0)
            ["currency":protected]=>
            string(3) "USD"
          }
          ["total_discount_money":protected]=>
          object(SquareConnect\Model\Money)#32 (2) {
            ["amount":protected]=>
            int(0)
            ["currency":protected]=>
            string(3) "USD"
          }
          ["total_money":protected]=>
          object(SquareConnect\Model\Money)#33 (2) {
            ["amount":protected]=>
            int(60000)
            ["currency":protected]=>
            string(3) "USD"
          }
        }
      }
      ["total_money":protected]=>
      object(SquareConnect\Model\Money)#34 (2) {
        ["amount":protected]=>
        int(60000)
        ["currency":protected]=>
        string(3) "USD"
      }
      ["total_tax_money":protected]=>
      object(SquareConnect\Model\Money)#35 (2) {
        ["amount":protected]=>
        int(0)
        ["currency":protected]=>
        string(3) "USD"
      }
      ["total_discount_money":protected]=>
      object(SquareConnect\Model\Money)#36 (2) {
        ["amount":protected]=>
        int(0)
        ["currency":protected]=>
        string(3) "USD"
      }
    }
    ["created_at":protected]=>
    string(20) "2018-08-13T15:42:57Z"
    ["additional_recipients":protected]=>
    NULL
  }
  ["errors":protected]=>
  NULL
}

响应对象:

object(SquareConnect\Model\RetrieveTransactionResponse)#17 (2) {
  ["errors":protected]=>
  NULL
  ["transaction":protected]=>
  object(SquareConnect\Model\Transaction)#18 (10) {
    ["id":protected]=>
    string(56) "A4ccOMcXsMJL14ZGAJUgQPqVW580zoRoGiVIQdWOgHLyXeThrKgTwLhO"
    ["location_id":protected]=>
    string(30) "xxxxxxxxxx"
    ["created_at":protected]=>
    string(20) "2018-08-13T15:49:50Z"
    ["tenders":protected]=>
    array(1) {
      [0]=>
      object(SquareConnect\Model\Tender)#19 (13) {
        ["id":protected]=>
        string(36) "2d306255-fe2e-59e9-411b-acb2bcec7a51"
        ["location_id":protected]=>
        string(30) "xxxxxxxxxx"
        ["transaction_id":protected]=>
        string(56) "A4ccOMcXsMJL14ZGAJUgQPqVW580zoRoGiVIQdWOgHLyXeThrKgTwLhO"
        ["created_at":protected]=>
        string(20) "2018-08-13T15:49:50Z"
        ["note":protected]=>
        string(18) "Online Transaction"
        ["amount_money":protected]=>
        object(SquareConnect\Model\Money)#20 (2) {
          ["amount":protected]=>
          int(60000)
          ["currency":protected]=>
          string(3) "USD"
        }
        ["tip_money":protected]=>
        NULL
        ["processing_fee_money":protected]=>
        object(SquareConnect\Model\Money)#21 (2) {
          ["amount":protected]=>
          int(1750)
          ["currency":protected]=>
          string(3) "USD"
        }
        ["customer_id":protected]=>
        string(30) "xxxxxxxxxx"
        ["type":protected]=>
        string(4) "CARD"
        ["card_details":protected]=>
        object(SquareConnect\Model\TenderCardDetails)#22 (3) {
          ["status":protected]=>
          string(8) "CAPTURED"
          ["card":protected]=>
          object(SquareConnect\Model\Card)#23 (8) {
            ["id":protected]=>
            NULL
            ["card_brand":protected]=>
            string(4) "VISA"
            ["last_4":protected]=>
            string(4) "1111"
            ["exp_month":protected]=>
            NULL
            ["exp_year":protected]=>
            NULL
            ["cardholder_name":protected]=>
            NULL
            ["billing_address":protected]=>
            NULL
            ["fingerprint":protected]=>
            string(64) "727f3523fa0152dbd702c84c6a9636df646d90100c305080ad7a185b954ad591"
          }
          ["entry_method":protected]=>
          string(5) "KEYED"
        }
        ["cash_details":protected]=>
        NULL
        ["additional_recipients":protected]=>
        NULL
      }
    }
    ["refunds":protected]=>
    NULL
    ["reference_id":protected]=>
    NULL
    ["product":protected]=>
    string(12) "EXTERNAL_API"
    ["client_id":protected]=>
    NULL
    ["shipping_address":protected]=>
    NULL
    ["order_id":protected]=>
    string(56) "A4ccOMcXsMJL14ZGAJUgQPqVW580zoRoGiVIQdWOgHLyXeThrKgTwLhO"
  }
}

没有交易 ID、结帐 ID 或其他您可以匹配以按照说明验证交易的 ID。

checkout_id 是发送到 redirect_url 的参数之一。结帐交易完成后,它将自动重定向到您指定的 url (redirect_url),格式如下:

http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx

可以将 checkoutId 参数与您提到的示例中保存的 id 进行比较。

参考资料: https://docs.connect.squareup.com/api/connect/v2#type-checkout