ParchePartnerURLScheme 1.0.1

ParchePartnerURLScheme 1.0.1

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Mar 2015

Maintained by Ellen Shapiro, Sean Wolter, Carl Hill-Popper.



  • By
  • Ellen Shapiro

Parche-PartnerURLScheme

The Parche Partner URL Scheme is intended to facilitate generating valet discounts for members of partner applications.

Any partner application will need to take the following steps to integrate:

  1. Set up your server to call the Parche Discount API.
  2. Set up your application to get the result of that call from your server.
  3. Use the provided convenience classes to call the URL scheme and send data to the Parche application.

Convenience classes will also include methods to determine if the user has the Parche application with a version supporting this URL scheme installed, and to launch the platform-appropriate App Store directly to the Parche application.

Integration With Your Server

When you sign up for a partnership with Parche, you will receive an API Key and an API Secret.

To increase security and prevent rewind attacks, we strongly recommend calling the Parche Discount API from your server rather than directly from your application. This has several security benefits:

  • Removes the need for storing your API secret in your application.
  • Your API key can be stored in plain text within the application since it's essentially useless without the secret.
  • Allows on-the-fly replacement of the secret in the event of compromise instead of having to wait for an update to get published.

While it is possible to call the discount API from your application, if you do so, you assume the risk of any compromise of your API secret.

Discount API

All calls to the Discount API are relative to the base URL:

  • Staging: https://api-staging.goparche.com
  • Production: https://api.goparche.com

Anything being tested against a version of the application downloaded directly from the iOS App Store or Google Play store should use the Production base URL.

If you are using a beta version of the application to test, Parche will let you know which API base URL you should be using.

Get Discount For Partner Application User

POST: /v1/partner/:api_key/create_discount``

Body:

{
    "partner_user_id": "[email protected]",
    "api_secret": "[your API secret]"
}

Notes:

  • partner_user_id: The user ID used by your system to refer to the current user (string)
  • api_key: The API key provided to you by Parche (string)
  • api_secret: The API secret provided to you by Parche (string)

Response:

{
    "discount_code": "UYGgYtg76GUIHIUHiuhIUhi7y8d120dkasd0mnjv"
}

Notes:

  • discount_code: The discount code to pass along to the application. (string)

Status Codes:

  • 201 if discount code was created
  • 400 if the fields in your request were incorrect
  • 403 if the wrong API key or API secret is provided

Integration With Applications

There are helper classes for each platform to facilitate calling the Parche URL scheme from your application. Each of these classes will require you to pass:

  • Your API key
  • The user ID used by your system to refer to the current user
  • The discount code generated by calling the discount code API.

Instructions on how to integrate with your applications and helper classes to facilitate this process can be found through the iOS and Android READMEs.

The iOS and Android folders contain sample applications which show how this can be integrated.