Core Development Concepts 2017-02-05T16:30:24+00:00

iOS – Core Development Concepts

The Jetpay SDK is easy to use, once a few key development concepts and SDK objectives are understood.

Firstly, the objectives of the SDK are the following:

  • To provide VALID and SECURE transactions on behalf of your app through the JetPay payment gateway
  • To provide payment processing through the TEST and PRODUCTION JetPay payment environments
  • To provide pre-built SDK objects to assist in the collection and validation of payment card and AVS data
  • To provide validation of all transaction data before submission to the Jetpay payment gateway
  • To provide for collection of transaction data from other data sources (for example, payment card data held in external databases)
  • To provide flexible and customisable SDK UI objects which integrate with your app’s particular look and feel

With the above in mind, the SDK provides the following objects:

JPClient is a singleton object and provides a high-level API into the Jetpay SDK. JPClient is not actually necessary as all supported Jetpay services can be successfully used via other objects. However, JPClient provides an alternative high-level interface for developer convenience.

JPConfiguration is a singleton object which holds environment-centric data (developer account, TEST or PRODUCTION environment to submit payments to, etc) and global settings shared other Jetpay SDK objects such as visual themes. Often, this data is initialised once per app lifecycle. You load this object with data through a well-defined API.

JPPaymentContext is a central “scratchpad” used to collect all necessary transaction data. Once data collection is complete, JPPaymentContext packages this data up into a transaction request and submits this request to the JetPay backend. All data held in the JPPaymentContext represents one transaction only.

JPPaymentContext can also load customer-centric data not required for JetPay processing. This allows an association to be made between the JetPay transaction represented in the JPPaymentContext and customer specific data such as customerID.

JPPaymentContext can either be loaded directly through a well defined API or can be loaded on your behalf by one of the SDK UI elements. This collection of data is often done piece-meal, and both direct and indirect loading of data is supported at the same time.

So, for example, your app may directly load your customer’s address into JPPaymentContext but your app can also use one of the SDK UI elements to collect the payment card details, populating JPPaymentContext on your behalf.

When ANY data is written to the JPPaymentContext, this data overwrites the previous value.

Once all your transaction data has been collected, JPPaymentContext can be requested to submit the transaction to the JetPay gateway. This can be done directly by your app or indirectly on your behalf through SDK UI objects.

Before submitting this transaction, JPPaymentContext collects, validates and formats all data.

If JPPaymentContext or JPConfiguration contain either INCOMPLETE or INVALID data, then JPPaymentContext will NOT attempt a submission to the Jetpay gateway.

JPTheme encapsulates a number of visual settings which constitute a look-and-feel for your UI objects. Fonts, background colours, borders, etc are all supported.

A “global theme” can be set in JPConfiguration, and all SDK UI objects without a specific theme set will inherit this “global theme”, giving a convenient way to set a common theme across all UI objects.

Three SDK UI objects have been provided. JPPaymentCardHorizontalField and JPPaymentCardVerticalField collect and validate payment card details on your behalf – in horizontal and vertical layout respectively. These are UIControls and can be integrated easily into your payment screen controllers.

JPAddCardViewController is a view controller which uses JPPaymentCardHorizontalField to collect payment card details, but also provides collection of customer details such as name, address, email address, phone etc.