diff --git a/README.md b/README.md index b591d7151..ac19b2196 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,52 @@ # Square Connect API Examples -**IMPORTANT:** On 16 February 2016, changes were made to the representation of a -Square merchant in the Connect API. These changes slightly altered the behavior of the -Connect API for applications created after 16 February. The samples in this repository -now reflect this altered behavior. If you created your Connect API application _before_ -16 February, samples that reflect your application's behavior are available in the -`v1` directory. - -On 23 May 2017, We made a significant improvement to our SDK to expand their -functionality and make them even easier to use. Unfortunately, some of the -changes are not backward compatible. The samples in this repository now contain -three different folders `v1`, `v2.0`, and `v2.1`. You can read more about the -new SDK in our [blog post](https://medium.com/square-corner-blog/announcing-our-new-versions-of-our-client-sdks-1336d26e8099) - -This repository contains simple code samples that demonstrate use of the Square Connect API. Complete documentation for the API is available at [connect.squareup.com](https://connect.squareup.com). - -If you have questions about Square Connect API features or implementation, please see the [FAQ](https://docs.connect.squareup.com/articles/faq/). +This repository contains code samples demonstrating the functionality of the +Square Connect API and templates to simplify use of our SDKs and APIs. + + +## In this repository + +* `connect-examples/oauth` - samples implementing OAuth +* `connect-examples/v1` - samples demonstrating Connect v1 functionality +* `connect-examples/v2` - samples demonstrating Connect v2 functionality +* `templates/` - code blocks and function definitions to simplify common usage + + +## Getting help + +Complete documentation for Square APIs is available at +[docs.connect.squareup.com]. + +If you have questions about Square Connect API features or implementation, +you can ask for help on [Stack Overflow] or in our [Slack community]. + + +-------------------------------------------------------------------------------- + +## Release notes + +### 2018-08-13 + +Updating directory structure and submitting inaugural code templates. + +### 2017-05-23 + +On 23 May 2017, we improved our SDKs to expand their functionality and make them +easier to use. Unfortunately, some of the changes are not backward compatible. +You can read more about the changes in our [SDK blog post]. + + +### 2016-02-16 + +On 16 February 2016, we changed the way merchant data is represented in the +Connect APIs. The data change also altered API behavior slightly. The samples +in this repository reflect this altered behavior. If you created your Connect +API application *before* 16 February, you can find samples that reflect your +application's behavior in the `v1` directory. + + +[//]: # "Link anchor definitions" +[SDK blog post]: https://medium.com/square-corner-blog/announcing-our-new-versions-of-our-client-sdks-1336d26e8099 +[Stack Overflow]: https://stackoverflow.com/questions/tagged/square-connect +[Slack community]: https://squ.re/2Hks3YE +[docs.connect.squareup.com]: https://docs.connect.squareup.com diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 000000000..590185ea7 --- /dev/null +++ b/templates/README.md @@ -0,0 +1,15 @@ +# Square Connect API Templates + +This directory contains code templates to simplify use of our SDKs and APIs. +These templates are also referenced in setup guides at +[docs.connect.squareup.com]. + +## In this directory + +* `php` - server-side code templates in PHP +* `web-ui` - client-side UI templates and themes for Square Payment Form + +-------------------------------------------------------------------------------- + +[//]: # "Link anchor definitions" +[docs.connect.squareup.com]: https://docs.connect.squareup.com diff --git a/templates/php/sq_config.php b/templates/php/sq_config.php new file mode 100644 index 000000000..b5320ab39 --- /dev/null +++ b/templates/php/sq_config.php @@ -0,0 +1,115 @@ + diff --git a/templates/web-ui/payment-form/README.md b/templates/web-ui/payment-form/README.md new file mode 100644 index 000000000..9b85a4b85 --- /dev/null +++ b/templates/web-ui/payment-form/README.md @@ -0,0 +1,12 @@ +# Templates and themes for Square Payment Form + +This directory contains collections of HTML, Javascript, and CSS templates for +Square Payment Form. For instructions on using this templates, see the Payment +Form Setup guide at [docs.connect.squareup.com]. + +## In this directory + +* `basic` - templates for a basic Payment Form integration + +[//]: # "Link anchor definitions" +[docs.connect.squareup.com]: https://docs.connect.squareup.com diff --git a/templates/web-ui/payment-form/basic/sqpaymentform-basic.css b/templates/web-ui/payment-form/basic/sqpaymentform-basic.css new file mode 100644 index 000000000..08aa5194a --- /dev/null +++ b/templates/web-ui/payment-form/basic/sqpaymentform-basic.css @@ -0,0 +1,102 @@ +/* Define how SqPaymentForm iframes should look */ +.sq-input { + border: 1px solid rgb(223, 223, 223); + outline-offset: -2px; + margin-bottom: 5px; + display: inline-block; +} + +/* Define how SqPaymentForm iframes should look when they have focus */ +.sq-input--focus { + outline: 5px auto rgb(59, 153, 252); +} + +/* Define how SqPaymentForm iframes should look when they contain invalid values */ +.sq-input--error { + outline: 5px auto rgb(255, 97, 97); +} + +/* Customize the "Pay with Credit Card" button */ +.button-credit-card { + min-width: 200px; + min-height: 20px; + padding: 0; + margin: 5px; + line-height: 20px; + box-shadow: 2px 2px 1px rgb(200, 200, 200); + background: rgb(255, 255, 255); + border-radius: 5px; + border: 1px solid rgb(200, 200, 200); + font-weight: bold; + cursor:pointer; +} + + +/* Customize the "{{Wallet}} not enabled" message */ +.wallet-not-enabled { + min-width: 200px; + min-height: 40px; + max-height: 64px; + padding: 0; + margin: 10px; + line-height: 40px; + background: #eee; + border-radius: 5px; + font-weight: lighter; + font-style: italic; + font-family: inherit; + display: block; +} + +/* Customize the Apple Pay on the Web button */ +.button-apple-pay { + min-width: 200px; + min-height: 40px; + max-height: 64px; + padding: 0; + margin: 10px; + background-image: -webkit-named-image(apple-pay-logo-white); + background-color: black; + background-size: 100% 60%; + background-repeat: no-repeat; + background-position: 50% 50%; + border-radius: 5px; + cursor:pointer; + display: none; +} + +/* Customize the Masterpass button */ +.button-masterpass { + min-width: 200px; + min-height: 40px; + max-height: 40px; + padding: 0; + margin: 10px; + background-image: url(https://static.masterpass.com/dyn/img/btn/global/mp_chk_btn_147x034px.svg); + background-color: black; + background-size: 100% 100%; + background-repeat: no-repeat; + background-position: 50% 50%; + border-radius: 5px; + border-color: rgb(255, 255, 255); + cursor:pointer; + display: none; +} + +#sq-walletbox { + float:left; + margin:5px; + padding:10px; + text-align: center; + vertical-align: top; + font-weight: bold; +} + +#sq-ccbox { + float:left; + margin:5px; + padding:10px; + text-align: center; + vertical-align: top; + font-weight: bold; +} diff --git a/templates/web-ui/payment-form/basic/sqpaymentform-basic.html b/templates/web-ui/payment-form/basic/sqpaymentform-basic.html new file mode 100644 index 000000000..c9fa0ba57 --- /dev/null +++ b/templates/web-ui/payment-form/basic/sqpaymentform-basic.html @@ -0,0 +1,74 @@ + + +
+ + + + + + + + + + + + + + +