【发布时间】:2018-08-13 15:57:53
【问题描述】:
Square Checkout API 设置指南示例位于:
https://docs.connect.squareup.com/payments/checkout/setup
说您需要存储 CheckoutId 以供以后验证。不幸的是,编写示例的人(除了我在其他地方提到的许多编码错误之外)没有完成示例并提供验证码。如果他们有,他们可能已经看到没有交易 id 匹配能力。
也许我遗漏了一些东西,但如果你比较 Checkout 对象
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 以按照指示验证交易。
【问题讨论】: