checkout - 更多 Square Checkout 示例问题 - 没有可用的验证 ID
问题描述
Square Checkout API 设置指南示例位于:
https://docs.connect.squareup.com/payments/checkout/setup
表示您需要存储 CheckoutId 以供以后验证。不幸的是,编写示例的人(除了我在其他地方提到的许多编码错误之外)没有完成示例并提供验证码。如果他们有,他们可能已经看到没有交易 id 匹配能力。
也许我错过了一些东西,但如果你比较 Checkout Object
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
推荐阅读
- bash - 如何使用 bash 从 ttf 字体获取字形宽度?
- r - r中的词干提取和wordnet包问题
- android - 如何在 SwipeRefreshLayout 中使用 ExpandableListView,而后者又在 CoordinatorLayout 中使用?
- php - 插入带有条件的mysql数据
- android - Scrollview 问题中的自定义 xml 布局充气器
- performance - FPS 测量
- karate - 空手道:具有多个场景的子功能在失败的情况下不会执行所有场景
- php - 在php中重复插入数据库
- angularjs - 如何在浏览器上运行离子默认侧边菜单
- visual-studio-code - 如何在 VSCode 中显示类似 F2 `Rename Symbol` 命令的弹出框