March 30, 2016
Have you ever looked at Square’s hardware offerings (maybe our newest EMV and NFC card reader) and thought, “I could build something amazing using that”? Historically, payments and hardware development were often associated with archaic and difficult to use technology. Today we are excited to launch Square’s Register and eCommerce APIs . Any developer can build an iOS app that takes payments from a swipe, dip, or tap. Developers can now also enable a website with online payments through Square.
The Square Register API lets you focus on what you do best: crafting an amazing point of sale experience for your merchants. We’ll take care of moving the money. With just two API calls, you tell us how much you’d like us to charge a customer and letSquare Register do all the heavy lifting. Customers pay just like they’re used to at any other Square merchant, and we’ll even text, email, or print a receipt on the merchant’s behalf. Best of all, it supports all our hardware, including theSquare Stand and the new Square Contactless + Chip Reader .
In your app make an API request:
[SCCAPIRequest requestWithCallbackURL:yourAppCallbackURL amount:amountToCharge userInfoString:dataWePassBackToYou merchantID:nil notes:descriptionOfCharge supportedTenderTypes:SCCAPIRequestTenderTypeCard clearsDefaultFees:NO error:&error]; [SCCAPIConnection performRequest:request error:&error];
Square Register switches to the foreground and completes the payment on your behalf. Once that’s done, we’ll call your app back with the result.
Now any developer can build solutions for their customers to take payments on a website using Square. Whether you’re getting started selling online with Square’s Online Store ; you’re growing through Square’s integrations witheCommerce platforms like Bigcommerce, Weebly, and Ecwid; or now, you’re building a custom website, any business can scale online with Square payments. What’s more, with our eCommerce API, Square takes the hassle out of PCI compliance without interfering with the design or look and feel of your website or re-directing customers off-site.
(See thedocs for a full working example).
Your server uses the card nonce and charges the buyer’s card.
$api = new /SquareConnect/Api/TransactionApi(); $transaction = $api->charge($accessToken, $locationId, [ 'amount_money' => ['amount' => 1337, 'currency' => 'USD'], 'idempotency_key' => uniqid(), 'card_nonce' => $cardNonce ])->getTransaction(); print_r($transaction);
Or you can store the card with a customer record to charge on an ongoing basis.
// Create the customer $customer = $customerApi->createCustomer($accessToken, [ 'given_name' => 'Customer Name', 'note' => "add a note" ])->getCustomer(); print_r($customer); // Link the card $card = $cardApi->createCustomerCard($accessToken, $customer->getId(), [ 'card_nonce' => $cardNonce, 'cardholder_name' => 'Customer Name', 'billing_address': [ 'postal_code' => '12345' ] ])->getCard(); print_r($card);
Bring it all together
With today’s launch of the Register and eCommerce APIs developers can build solutions that provide any seller with online and in-person payments, all powered by Square. When you use Square’s commerce platform, you are giving the seller a solution that results in a single, cohesive view of their entire business. Sellers can identify when customers are purchasing online, in-store, or across both. Using Square’s APIs and tools make it simple for sellers to better understand their customers’ buying trends and habits. Finally, because developers are leveraging Square’s platform, the seller can also benefit from everything that Square payments offers: transparent pricing, no monthly fees, support for challenging chargebacks, chargeback protection, great analytics, open APIs, as well as access to Square Capital and Square’s SaaS offerings.
Get started today by signing up for Square , reading thedocumentation, andcreating an app.
转载本站任何文章请注明：转载至神刀安全网，谢谢神刀安全网 » Introducing Square’s Register API and eCommerce API