thechefzpayments

Documentation for TheChefzPayments

Table of Contents

Installation

To install TheChefzPayments, follow these steps:

  1. Ensure you have CocoaPods installed by running the command pod --version in your terminal. If not installed, refer to the CocoaPods website for installation instructions.
  2. Add TheChefzPayments to your project’s Podfile:
    pod 'TheChefzPayments'
  3. Run pod install in your project’s root directory.
  4. Open your project’s .xcworkspace file to start using TheChefzPayments.

Usage

Follow these steps to use TheChefzPayments in your project:

  1. Import the framework in your source file:
    import TheChefzPayments
  2. Create an instance of TheChefzPaymentsManager:
    let paymentsManager = TheChefzPaymentsManager()
  3. Configure the manager with your payment provider keys:
    paymentsManager.configure(with: "yourPublicKey", and: "yourPrivateKey")
  4. Use the manager’s methods to process payments and handle payment callbacks.

API Reference

TheChefzPayments provides the following methods:

  1. configure(with:and:)
    Configures the payment manager with your payment provider keys.

    Parameters:

    • publicKey (String): Your payment provider public key.
    • privateKey (String): Your payment provider private key.
  2. processPayment(with:)
    Processes a payment with the provided payment details.

    Parameters:

    • paymentDetails (PaymentDetails): Contains payment information like amount, currency, and customer details.
  3. handlePaymentCallback(from:)
    Handles the payment callback received from the payment provider.

    Parameters:

    • url (URL): The URL received in the app delegate’s openURL method.

Examples

Example 1: Configuring TheChefzPaymentsManager

// Import the framework
import TheChefzPayments

// Create an instance of TheChefzPaymentsManager
let paymentsManager = TheChefzPaymentsManager()

// Configure the manager with your payment provider keys
paymentsManager.configure(with: "yourPublicKey", and: "yourPrivateKey")

Example 2: Processing a Payment

// Create a PaymentDetails object
let paymentDetails = PaymentDetails(amount: 50.0, currency: "USD", customerName: "John Doe", customerEmail: "john.doe@example.com")

// Process payment using the manager
paymentsManager.processPayment(with: paymentDetails)

Example 3: Handling Payment Callback

// In your app delegate's openURL method, call handlePaymentCallback
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    paymentsManager.handlePaymentCallback(from: url)
    return true
}

Support

If you need any assistance or have any questions, please contact our support team at support@example.com.