### Get Plan Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves details of a specific payment plan using its ID. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundPlan = epayco.plan.get(planId: "hello-world") let isPlanValid = foundPlan != nil ``` -------------------------------- ### Get Subscription Plan by ID with Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieves the details of a specific subscription plan using its identifier. Ensure the Epayco SDK is initialized. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener plan por ID let plan = epayco.plan.get(planId: "plan-premium-mensual") if let planData = plan { print("Plan encontrado: \(planData)") // Acceder a planData.name, planData.amount, etc. } else { print("Plan no encontrado") } ``` -------------------------------- ### GET /subscriptions Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieves a list of all subscriptions registered to the merchant account. ```APIDOC ## GET /subscriptions ### Description Retrieves a list of all subscriptions registered to the merchant account. ### Method GET ### Endpoint epayco.subscription.getList() ``` -------------------------------- ### GET /cash/getTransaction Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves details of a cash transaction by reference. ```APIDOC ## GET /cash/getTransaction ### Description Retrieves the status and details of a previously created cash transaction. ### Parameters #### Query Parameters - **refPayco** (string) - Required - The ePayco reference ID ``` -------------------------------- ### Get Subscription Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves details of a specific subscription using its ID. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundSubscription = epayco.subscription.get(subscriptionId: "079c3101f4d672b3a161132") let isSubscriptionValid = foundSubscription != nil ``` -------------------------------- ### Get Customer Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieve the full details of a registered customer using their unique identifier. ```APIDOC ## Get Customer ### Description Retrieves the complete information of a registered customer using their unique identifier. ### Method GET ### Endpoint `/customers/{customerId}` ### Parameters #### Path Parameters - **customerId** (string) - Required - The unique identifier of the customer to retrieve. ### Request Example ```swift let customer = epayco.customer.get(customerId: "kXyobRkeyBkJPTd57") ``` ### Response #### Success Response (200) - **id** (string) - Customer's unique identifier. - **name** (string) - Customer's first name. - **last_name** (string) - Customer's last name. - **email** (string) - Customer's email address. - **city** (string) - Customer's city. - **address** (string) - Customer's address. - **phone** (string) - Customer's phone number. - **cell_phone** (string) - Customer's mobile phone number. #### Response Example ```json { "id": "kXyobRkeyBkJPTd57", "name": "Juan", "last_name": "Pérez", "email": "juan.perez@ejemplo.com", "city": "Bogotá", "address": "Calle 123 #45-67", "phone": "6011234567", "cell_phone": "3001234567" } ``` ``` -------------------------------- ### GET /bank/getTransaction Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves details of a bank transaction. ```APIDOC ## GET /bank/getTransaction ### Description Retrieves the status and details of a bank transaction by its ID. ### Parameters #### Query Parameters - **transactionId** (string) - Required - The unique transaction ID ``` -------------------------------- ### Get Customer Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieve the complete information of a registered customer using their unique identifier. This function is useful for fetching customer details for display or further transactions. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener cliente por ID let customer = epayco.customer.get(customerId: "kXyobRkeyBkJPTd57") if let customerData = customer { print("Cliente encontrado: \(customerData)") // Acceder a customerData.name, customerData.email, etc. } else { print("Cliente no encontrado") } ``` -------------------------------- ### Get List of Available Banks Source: https://context7.com/epayco/sdk_ios/llms.txt Fetch the list of banks supported for PSE transactions. The bank codes obtained are necessary for creating bank transfers. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener lista de bancos let banksList = epayco.bank.getBanksList() if let banks = banksList { print("Bancos disponibles: \(banks)") // Mostrar selector de bancos al usuario // Cada banco tiene código (ej: "1007") y nombre (ej: "Bancolombia") } else { print("Error al obtener bancos") } ``` -------------------------------- ### Get Available Banks List - Swift Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieve a list of available banks supported by Epayco. This function requires an initialized Epayco object. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundBanks = epayco.bank.getBanksList() let isBanksListValid = foundBanks != nil ``` -------------------------------- ### GET /subscription/{subscriptionId} Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieves the details of a specific subscription, including its current status. ```APIDOC ## GET /subscription/{subscriptionId} ### Description Retrieves the details of a specific subscription, including its current status. ### Method GET ### Endpoint epayco.subscription.get(subscriptionId: String) ### Parameters #### Path Parameters - **subscriptionId** (String) - Required - The unique identifier of the subscription. ``` -------------------------------- ### Initialize Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Configure the main Epayco instance with your merchant credentials. Use the `test` parameter to switch between test and production environments. ```swift import epayco_ios // Inicializar con credenciales del comercio let epayco = Epayco( publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true // true para pruebas, false para producción ) // El objeto epayco provee acceso a todos los recursos: // - epayco.token : Gestión de tokens de tarjeta // - epayco.customer : Gestión de clientes // - epayco.plan : Gestión de planes de suscripción // - epayco.subscription : Gestión de suscripciones // - epayco.cash : Pagos en efectivo // - epayco.bank : Transferencias bancarias (PSE) // - epayco.charge : Cobros con tarjeta ``` -------------------------------- ### SDK Initialization Source: https://context7.com/epayco/sdk_ios/llms.txt Initialize the Epayco SDK with your public and private keys. The `test` parameter enables test mode. ```APIDOC ## SDK Initialization ### Description Configure the main Epayco instance with the merchant's credentials. The `test` parameter allows switching between test and production environments. ### Method Initialization ### Endpoint N/A ### Parameters #### Initialization Parameters - **publicKey** (string) - Required - Your public API key. - **privateKey** (string) - Required - Your private API key. - **lang** (string) - Optional - Language code for the SDK (e.g., "ES"). - **test** (boolean) - Required - `true` for test mode, `false` for production. ### Request Example ```swift import epayco_ios let epayco = Epayco( publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true // true for tests, false for production ) ``` ### Response N/A (Initialization does not return a value, but configures the SDK instance.) ``` -------------------------------- ### List All Subscription Plans with Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Obtains a list of all subscription plans configured for the merchant account. Requires Epayco SDK initialization. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener lista de planes let plansList = epayco.plan.getList() if let plans = plansList { print("Planes disponibles: \(plans)") } else { print("Error al obtener planes") } ``` -------------------------------- ### Create Customer Source: https://context7.com/epayco/sdk_ios/llms.txt Register a new customer with contact information and an associated card token. The customer can be used for subscriptions and recurring charges. Ensure `NewCustomerModel` is populated with necessary details, including a valid `token_card`. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Crear modelo de cliente let newCustomerData = NewCustomerModel( token_card: "079d69316b80741cc515af3", // Token de tarjeta previamente creado name: "Juan", last_name: "Pérez", email: "juan.perez@ejemplo.com", isDefault: true, // Tarjeta por defecto city: "Bogotá", address: "Calle 123 #45-67", phone: "6011234567", cell_phone: "3001234567" ) // Registrar cliente let customerResult = epayco.customer.create(newCustomerData: newCustomerData) if let customer = customerResult { print("Cliente creado con ID: \(customer)") // Guardar customer.id para futuras transacciones } else { print("Error al crear cliente") } ``` -------------------------------- ### List Plans Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves a list of all available payment plans. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundPlans = epayco.plan.getList() let isPlansListValid = foundPlans != nil ``` -------------------------------- ### Create Customer Source: https://context7.com/epayco/sdk_ios/llms.txt Register a new customer with contact information and an associated card token for recurring payments. ```APIDOC ## Create Customer ### Description Registers a new customer in the system with their contact information and an associated card token. The customer can be used for subscriptions and recurring charges. ### Method POST ### Endpoint `/customers` (Conceptual) ### Parameters #### Request Body - **token_card** (string) - Required - The token of the card previously created. - **name** (string) - Required - Customer's first name. - **last_name** (string) - Required - Customer's last name. - **email** (string) - Required - Customer's email address. - **isDefault** (boolean) - Optional - Set to `true` if this card should be the default payment method. - **city** (string) - Optional - Customer's city. - **address** (string) - Optional - Customer's address. - **phone** (string) - Optional - Customer's phone number. - **cell_phone** (string) - Optional - Customer's mobile phone number. ### Request Example ```json { "token_card": "079d69316b80741cc515af3", "name": "Juan", "last_name": "Pérez", "email": "juan.perez@ejemplo.com", "isDefault": true, "city": "Bogotá", "address": "Calle 123 #45-67", "phone": "6011234567", "cell_phone": "3001234567" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly created customer. #### Response Example ```json { "id": "kXyobRkeyBkJPTd57" } ``` ``` -------------------------------- ### Create Customer Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a new customer profile with provided details. Requires a card token for associated payment information. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newCustomerData = NewCustomerModel(token_card:"079d69316b", name: "hello", last_name: "world", email: "prueba@correo.co", isDefault: false, city: "Miami", address: "Av...", phone: "555555", cell_phone: "55555") let newCustomer = epayco.customer.create(newCustomerData: newCustomerData) let isCustomerValid = newCustomer != nil ``` -------------------------------- ### Create Subscription Plan with Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Creates a new recurring payment plan with a defined interval and amount. Requires a unique plan ID, name, description, amount, currency, interval, interval count, and optional trial days. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Crear modelo de plan let newPlanData = NewPlanModel( id_plan: "plan-premium-mensual", // ID único del plan name: "Plan Premium Mensual", // Nombre descriptivo description: "Acceso premium mensual", // Descripción amount: 49900.00, // Monto a cobrar currency: "COP", // Moneda (COP, USD) interval: "month", // Intervalo: day, week, month, year interval_count: 1, // Cada cuántos intervalos cobrar trial_days: 7 // Días de prueba gratis ) // Crear plan let planResult = epayco.plan.create(newPlanData: newPlanData) if let plan = planResult { print("Plan creado: \(plan)") } else { print("Error al crear plan") } ``` -------------------------------- ### Listar Clientes Source: https://context7.com/epayco/sdk_ios/llms.txt Obtiene la lista completa de todos los clientes registrados en la cuenta del comercio. ```APIDOC ## GET /customers ### Description Obtiene la lista completa de todos los clientes registrados en la cuenta del comercio. ### Method GET ### Endpoint epayco.customer.getList() ``` -------------------------------- ### Actualizar Cliente Source: https://context7.com/epayco/sdk_ios/llms.txt Modifica el nombre de un cliente existente. ```APIDOC ## PUT /customers/{customerId} ### Description Modifica el nombre de un cliente existente. ### Method PUT ### Endpoint epayco.customer.update(customerId: String, newName: String) ### Parameters #### Path Parameters - **customerId** (String) - Required - ID del cliente a actualizar #### Request Body - **newName** (String) - Required - Nuevo nombre del cliente ``` -------------------------------- ### Create Subscription Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a new subscription for a customer to a specific plan. Requires plan ID, customer ID, and payment details. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newSubscriptionData = NewSubscriptionModel(id_plan: "hello", customer: "kXyobRkeyBkJPTd57", token_card: "078e181c073f", doc_type: "CC", doc_number: "55555", url_confirmation: "", method_confirmation: "") let newSubscription = epayco.subscription.create(newSubscriptionData: newSubscriptionData) let isSubscriptionValid = newSubscription != nil ``` -------------------------------- ### POST /cash/create Source: https://context7.com/epayco/sdk_ios/llms.txt Generates a cash payment reference for authorized points like Efecty, Baloto, etc. ```APIDOC ## POST /cash/create ### Description Generates a payment reference for the customer to pay in cash at authorized points. ### Method POST ### Endpoint epayco.cash.create(paymentMethod: String, newCashTransactionData: NewCashTransactionModel) ### Parameters #### Request Body - **invoice** (String) - Required - Invoice number - **description** (String) - Required - Transaction description - **value** (String) - Required - Transaction value - **tax** (String) - Required - Tax amount - **taxBase** (String) - Required - Tax base - **currency** (String) - Required - Currency code (e.g., COP) - **personType** (String) - Required - 0 for Natural, 1 for Juridical - **docType** (String) - Required - Document type - **docNumber** (String) - Required - Document number - **name** (String) - Required - First name - **lastName** (String) - Required - Last name - **email** (String) - Required - Email address - **cellPhone** (String) - Required - Cell phone - **country** (String) - Required - Country code - **city** (String) - Required - City - **endDate** (String) - Required - Payment deadline - **ip** (String) - Required - Client IP - **responseUrl** (String) - Required - Response URL - **confirmationUrl** (String) - Required - Confirmation URL - **confirmationMethod** (String) - Required - Confirmation method (e.g., POST) ``` -------------------------------- ### List Customers with Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieves a list of all registered customers for the merchant account. Requires Epayco SDK initialization. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener lista de clientes let customersList = epayco.customer.getList() if let customers = customersList { print("Total de clientes: \(customers)") // Iterar sobre la lista de clientes } else { print("Error al obtener lista de clientes") } ``` -------------------------------- ### Execute Manual Subscription Charge in Swift Source: https://context7.com/epayco/sdk_ios/llms.txt Performs a one-time manual charge for an existing subscription using SubscriptionChargeModel. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Crear modelo de cobro de suscripción let chargeData = SubscriptionChargeModel( id_plan: "plan-premium-mensual", // ID del plan customer: "kXyobRkeyBkJPTd57", // ID del cliente token_card: "079d69316b80741cc515af3", // Token de tarjeta doc_type: "CC", // Tipo de documento doc_number: "1234567890", // Número de documento ip: "190.0.0.1", // IP del cliente address: "Calle 123 #45-67", // Dirección phone: "6011234567", // Teléfono cell_phone: "3001234567" // Celular ) // Ejecutar cobro let chargeResult = epayco.subscription.charge(subscriptionChargeData: chargeData) if let charge = chargeResult { print("Cobro ejecutado: \(charge)") } else { print("Error al cobrar suscripción") } ``` -------------------------------- ### Crear Suscripción Source: https://context7.com/epayco/sdk_ios/llms.txt Suscribe un cliente a un plan de cobro recurrente. ```APIDOC ## POST /subscriptions ### Description Suscribe un cliente a un plan de cobro recurrente. ### Method POST ### Endpoint epayco.subscription.create(newSubscriptionData: NewSubscriptionModel) ### Request Body - **id_plan** (String) - Required - ID del plan - **customer** (String) - Required - ID del cliente - **token_card** (String) - Required - Token de tarjeta - **doc_type** (String) - Required - Tipo documento: CC, NIT, CE, TI, PP - **doc_number** (String) - Required - Número de documento - **url_confirmation** (String) - Optional - URL de confirmación - **method_confirmation** (String) - Optional - Método HTTP para confirmación ``` -------------------------------- ### Create Plan Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a new recurring payment plan with specified details such as amount, currency, and interval. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newPlanData = NewPlanModel(id_plan: "hello", name: "Hello", description: "Hello", amount: 5000.50, currency: "COP", interval: "week", interval_count: 3, trial_days: 0) let newPlan = epayco.plan.create(newPlanData: newPlanData) let isPlanValid = newPlan != nil ``` -------------------------------- ### List Customers Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves a list of all customers associated with the account. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundCustomers = epayco.customer.getList() let isCustomersListValid = foundCustomers != nil ``` -------------------------------- ### POST /subscription/charge Source: https://context7.com/epayco/sdk_ios/llms.txt Executes a manual charge associated with an existing subscription. ```APIDOC ## POST /subscription/charge ### Description Executes a manual charge associated with an existing subscription. Useful for additional charges or retries. ### Method POST ### Endpoint epayco.subscription.charge(subscriptionChargeData: SubscriptionChargeModel) ### Parameters #### Request Body - **id_plan** (String) - Required - ID of the plan - **customer** (String) - Required - ID of the customer - **token_card** (String) - Required - Token of the card - **doc_type** (String) - Required - Document type - **doc_number** (String) - Required - Document number - **ip** (String) - Required - Client IP address - **address** (String) - Required - Billing address - **phone** (String) - Required - Phone number - **cell_phone** (String) - Required - Cell phone number ``` -------------------------------- ### Obtener Plan Source: https://context7.com/epayco/sdk_ios/llms.txt Recupera los detalles de un plan de suscripción específico por su identificador. ```APIDOC ## GET /plans/{planId} ### Description Recupera los detalles de un plan de suscripción específico por su identificador. ### Method GET ### Endpoint epayco.plan.get(planId: String) ### Parameters #### Path Parameters - **planId** (String) - Required - ID del plan ``` -------------------------------- ### Crear Plan de Suscripción Source: https://context7.com/epayco/sdk_ios/llms.txt Crea un plan de cobro recurrente con intervalo y monto definidos. ```APIDOC ## POST /plans ### Description Crea un plan de cobro recurrente con intervalo y monto definidos. ### Method POST ### Endpoint epayco.plan.create(newPlanData: NewPlanModel) ### Request Body - **id_plan** (String) - Required - ID único del plan - **name** (String) - Required - Nombre descriptivo - **description** (String) - Optional - Descripción - **amount** (Float) - Required - Monto a cobrar - **currency** (String) - Required - Moneda (COP, USD) - **interval** (String) - Required - Intervalo: day, week, month, year - **interval_count** (Int) - Required - Cada cuántos intervalos cobrar - **trial_days** (Int) - Optional - Días de prueba gratis ``` -------------------------------- ### Retrieve Subscription Details in Swift Source: https://context7.com/epayco/sdk_ios/llms.txt Fetches specific subscription data by ID. Requires a valid subscription ID string. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener suscripción por ID let subscription = epayco.subscription.get(subscriptionId: "079c3101f4d672b3a161132") if let subscriptionData = subscription { print("Suscripción encontrada: \(subscriptionData)") // Verificar estado, próximo cobro, etc. } else { print("Suscripción no encontrada") } ``` -------------------------------- ### List All Subscriptions in Swift Source: https://context7.com/epayco/sdk_ios/llms.txt Retrieves a list of all subscriptions associated with the merchant account. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Obtener lista de suscripciones let subscriptionsList = epayco.subscription.getList() if let subscriptions = subscriptionsList { print("Suscripciones: \(subscriptions)") } else { print("Error al obtener suscripciones") } ``` -------------------------------- ### POST /subscription/charge Source: https://github.com/epayco/sdk_ios/blob/master/README.md Charges a subscription plan to a customer. ```APIDOC ## POST /subscription/charge ### Description Charges a specific subscription plan to a customer using their tokenized card information. ### Request Body - **id_plan** (string) - Required - The ID of the subscription plan - **customer** (string) - Required - The customer ID - **token_card** (string) - Required - The tokenized card ID - **doc_type** (string) - Required - Document type - **doc_number** (string) - Required - Document number - **ip** (string) - Required - Customer IP address - **address** (string) - Required - Billing address - **phone** (string) - Required - Phone number - **cell_phone** (string) - Required - Cell phone number ``` -------------------------------- ### Create Subscription with Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Subscribes a customer to a recurring payment plan. Requires the plan ID, customer ID, card token, document type, document number, and optional confirmation URL and method. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Crear modelo de suscripción let newSubscriptionData = NewSubscriptionModel( id_plan: "plan-premium-mensual", // ID del plan customer: "kXyobRkeyBkJPTd57", // ID del cliente token_card: "079d69316b80741cc515af3", // Token de tarjeta doc_type: "CC", // Tipo documento: CC, NIT, CE, TI, PP doc_number: "1234567890", // Número de documento url_confirmation: "https://tudominio.com/webhook", // URL de confirmación (opcional) method_confirmation: "POST" // Método HTTP para confirmación (opcional) ) // Crear suscripción let subscriptionResult = epayco.subscription.create(newSubscriptionData: newSubscriptionData) if let subscription = subscriptionResult { print("Suscripción creada: \(subscription)") // Guardar subscription.id para gestión posterior } else { print("Error al crear suscripción") } ``` -------------------------------- ### POST /cash/create Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a new cash payment transaction. ```APIDOC ## POST /cash/create ### Description Creates a cash transaction (e.g., Efecty, Sured) with optional split payment data. ### Request Body - **invoice** (string) - Required - Invoice identifier - **description** (string) - Required - Transaction description - **value** (string) - Required - Transaction amount - **currency** (string) - Required - Currency code (e.g., COP) - **doc_number** (string) - Required - Document number - **email** (string) - Required - Customer email - **paymentMethod** (string) - Required - The cash payment method (e.g., efecty, sured) ``` -------------------------------- ### Retrieve Customer Source: https://github.com/epayco/sdk_ios/blob/master/README.md Fetches a specific customer's details using their customer ID. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundCustomer = epayco.customer.get(customerId: "kXyobRkeyBkJPTd57") let isCustomerValid = foundCustomer != nil ``` -------------------------------- ### Eliminar Plan Source: https://context7.com/epayco/sdk_ios/llms.txt Elimina un plan de suscripción del sistema. ```APIDOC ## DELETE /plans/{planId} ### Description Elimina un plan de suscripción del sistema. ### Method DELETE ### Endpoint epayco.plan.remove(planId: String) ### Parameters #### Path Parameters - **planId** (String) - Required - ID del plan ``` -------------------------------- ### Create Card Token Source: https://github.com/epayco/sdk_ios/blob/master/README.md Use this method to create a new card token for secure transaction processing. Ensure you have valid card details. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newTokenCard = CardTokenModel(number: "4222222222222225", exp_year: "2030", exp_month: "06", cvc: "021") let newTokenData = NewTokenModel(card: newTokenCard) let newToken = epayco.token.create(newTokenData: newTokenData) let isTokenValid = newToken != nil ``` -------------------------------- ### POST /charge/create Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a new credit card charge transaction. ```APIDOC ## POST /charge/create ### Description Processes a credit card payment charge. ### Request Body - **token_card** (string) - Required - Tokenized card ID - **customer_id** (string) - Required - Customer ID - **value** (string) - Required - Transaction amount - **currency** (string) - Required - Currency code - **description** (string) - Required - Transaction description ``` -------------------------------- ### Create Cash Payment with Split Payment in Swift Source: https://context7.com/epayco/sdk_ios/llms.txt Initializes a cash transaction with multiple receivers. Requires configuring NewCashTransactionModel, SplitReceiverModel, and SplitDataModel before calling the create method. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Datos de la transacción let cashTransactionData = NewCashTransactionModel( invoice: "FAC-001235", description: "Compra marketplace", value: "200000", tax: "0", taxBase: "0", currency: "COP", personType: "0", docType: "CC", docNumber: "1234567890", name: "Juan", lastName: "Pérez", email: "juan.perez@ejemplo.com", cellPhone: "3001234567", country: "CO", city: "Bogotá", endDate: "2024-12-31", ip: "190.0.0.1", responseUrl: "", confirmationUrl: "", confirmationMethod: "POST" ) // Configurar receptores del split let receptor1 = SplitReceiverModel( id: "30085", // ID del receptor fee: "10", // Comisión porcentual fee_type: "01", // Tipo de comisión total: "100000" // Monto para este receptor ) let receptor2 = SplitReceiverModel( id: "30086", fee: "10", fee_type: "01", total: "100000" ) // Configurar datos del split let splitData = SplitDataModel( ip: "190.0.0.1", splitpayment: "true", split_app_id: "30085", split_merchant_id: "30085", split_type: "02", split_rule: "multiple", split_primary_receiver: "30085", split_primary_receiver_fee: "10", split_receivers: [receptor1, receptor2] ) // Crear transacción con split let cashTransaction = epayco.cash.create( paymentMethod: "sured", newCashTransactionData: cashTransactionData, splitData: splitData ) if let transaction = cashTransaction { print("Split payment creado: \(transaction)") } else { print("Error al crear split payment") } ``` -------------------------------- ### Charge Subscription Payment Source: https://github.com/epayco/sdk_ios/blob/master/README.md Use this to charge a subscription payment for a customer. Ensure all required `SubscriptionChargeModel` fields are populated. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let chargeData = SubscriptionChargeModel(id_plan: "hello-world", customer: "kXyobRkeyBkJPTd57", token_card: "079d69316b80741cc515af3", doc_type: "CC", doc_number: "55555", ip: "10.0.0.1", address: "Av...", phone: "55555555555", cell_phone: "5555555555") let subscriptionCharge = epayco.subscription.charge(subscriptionChargeData: chargeData) let isSubscriptionCharged = subscriptionCharge != nil ``` -------------------------------- ### POST /bank/create Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a new bank transfer transaction (PSE). ```APIDOC ## POST /bank/create ### Description Initiates a bank transfer payment transaction. ### Request Body - **bank** (string) - Required - Bank identifier - **invoice** (string) - Required - Invoice identifier - **value** (string) - Required - Transaction amount - **currency** (string) - Required - Currency code - **email** (string) - Required - Customer email ``` -------------------------------- ### Create Card Token Source: https://context7.com/epayco/sdk_ios/llms.txt Generate a secure token from credit/debit card details for future use in transactions. ```APIDOC ## Create Card Token ### Description Generates a secure token from credit/debit card data. This token is used for subsequent charges without exposing sensitive card details. ### Method POST ### Endpoint `/tokens` (Conceptual) ### Parameters #### Request Body - **card** (object) - Required - Contains card details. - **number** (string) - Required - Credit/debit card number. - **exp_year** (string) - Required - Expiration year (e.g., "2030"). - **exp_month** (string) - Required - Expiration month (e.g., "12"). - **cvc** (string) - Required - Card security code. ### Request Example ```json { "card": { "number": "4575623182290326", "exp_year": "2030", "exp_month": "12", "cvc": "123" } } ``` ### Response #### Success Response (200) - **id** (string) - The generated token ID. - **last_four** (string) - The last four digits of the card number. - **franchise** (string) - The card network (e.g., "visa"). #### Response Example ```json { "id": "079d69316b80741cc515af3", "last_four": "0326", "franchise": "visa" } ``` ``` -------------------------------- ### Listar Planes Source: https://context7.com/epayco/sdk_ios/llms.txt Obtiene todos los planes de suscripción configurados en la cuenta del comercio. ```APIDOC ## GET /plans ### Description Obtiene todos los planes de suscripción configurados en la cuenta del comercio. ### Method GET ### Endpoint epayco.plan.getList() ``` -------------------------------- ### Create Bank Transaction Source: https://github.com/epayco/sdk_ios/blob/master/README.md Initiates a bank transaction. Requires `NewBankTransactionModel` with bank details, invoice information, and customer data. Specify the `bank` code. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newBankTransactionData = NewBankTransactionModel(bank: "1059", invoice: "hello-world", description: "Hello World", value: "20000", tax: "0", taxBase: "0", currency: "COP", personType: "0", docType: "CC", docNumber: "55555", name: "name", lastName: "last name", email: "roberto.meran@payco.co", country: "CO", cellPhone: "5555555555", responseUrl: "", confirmationUrl: "", confirmationMethod: "GET", ip: "10.0.0.1", extra1: "", extra2: "", extra3: "", extra4: "", extra5: "", extra6: "", extra7: "") let createdTransaction = epayco.bank.create(newBankTransactionData: newBankTransactionData) let isTransactionValid = createdTransaction != nil ``` -------------------------------- ### List Subscriptions Source: https://github.com/epayco/sdk_ios/blob/master/README.md Retrieves a list of all active subscriptions. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let foundSubscriptions = epayco.subscription.getList() let isSubscriptionsListValid = foundSubscriptions != nil ``` -------------------------------- ### Create Cash Transaction Source: https://github.com/epayco/sdk_ios/blob/master/README.md Initiates a new cash transaction. Requires `NewCashTransactionModel` with payment details. The `paymentMethod` can be 'efecty' or 'sured'. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newCashTransactionData = NewCashTransactionModel(invoice: "hello", description: "hello", value: "20040", tax: "0", taxBase: "0", currency: "COP", personType: "1", docType: "CC", docNumber: "55555", name: "hello", lastName: "world", email: "roberto.meran@payco.co", cellPhone: "555555555555", endDate: "2022-05-02", ip: "10.0.0.1", responseUrl: "", confirmationUrl: "", confirmationMethod: "POST") let newCashTransaction = epayco.cash.create(paymentMethod: "efecty", newCashTransactionData: newCashTransactionData) let isTransactionValid = newCashTransaction != nil ``` -------------------------------- ### Create Charge Transaction Source: https://github.com/epayco/sdk_ios/blob/master/README.md Creates a direct charge transaction using a card token and customer information. Requires `NewChargeTransactionModel`. ```swift let epayco = Epayco(publicKey: "XXXXXXXXXX", privateKey: "XXXXXXXX", lang: "ES", test: false) let newChargeTransactionData = NewChargeTransactionModel(token_card: "079d69316b80741cc515af3", customer_id: "kXyobRkeyBkJPTd57", doc_type: "CC", doc_number: "55555", name: "Hello", last_name: "World", email: "roberto.meran@payco.co", bill: "hello-world4", description: "Hello World", value: "5040.5", tax: "0", tax_base: "0", currency: "COP", dues: "1", address: "Av...", phone: "55555555555", cell_phone: "55555555555", url_response: "", url_confirmation: "", ip: "10.0.0.1", extras: nil) let newTransaction = epayco.charge.create(newChargeTransactionData: newChargeTransactionData) let isTransactionValid = newTransaction != nil ``` -------------------------------- ### Create Cash Payment Transaction in Swift Source: https://context7.com/epayco/sdk_ios/llms.txt Generates a payment reference for cash-based transactions at authorized points using NewCashTransactionModel. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Crear modelo de transacción en efectivo let cashTransactionData = NewCashTransactionModel( invoice: "FAC-001234", // Número de factura description: "Compra en tienda online", // Descripción value: "150000", // Valor en centavos o unidades tax: "0", // IVA taxBase: "0", // Base gravable currency: "COP", // Moneda personType: "0", // 0: Natural, 1: Jurídica docType: "CC", // Tipo documento docNumber: "1234567890", // Número documento name: "Juan", // Nombre lastName: "Pérez", // Apellido email: "juan.perez@ejemplo.com", // Email cellPhone: "3001234567", // Celular country: "CO", // País city: "Bogotá", // Ciudad endDate: "2024-12-31", // Fecha límite de pago ip: "190.0.0.1", // IP del cliente responseUrl: "https://tudominio.com/respuesta", // URL respuesta confirmationUrl: "https://tudominio.com/confirmacion", // URL confirmación confirmationMethod: "POST" // Método confirmación ) // Crear transacción - Métodos disponibles: efecty, baloto, gana, redservi, puntored, sured let cashTransaction = epayco.cash.create( paymentMethod: "efecty", // Método de pago newCashTransactionData: cashTransactionData ) if let transaction = cashTransaction { print("Referencia de pago creada: \(transaction)") // Mostrar al usuario el código de pago y fecha límite } else { print("Error al crear pago en efectivo") } ``` -------------------------------- ### Create Card Token Source: https://context7.com/epayco/sdk_ios/llms.txt Generate a secure token from credit/debit card details. This token is used for subsequent charges without exposing sensitive card information. Ensure `CardTokenModel` is correctly populated with card details. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Crear modelo de tarjeta con datos del titular let cardData = CardTokenModel( number: "4575623182290326", // Número de tarjeta exp_year: "2030", // Año de expiración exp_month: "12", // Mes de expiración cvc: "123" // Código de seguridad ) // Generar token let newTokenData = NewTokenModel(card: cardData) let tokenResult = epayco.token.create(newTokenData: newTokenData) if let token = tokenResult { print("Token creado: \(token)") // Usar token.id para cobros posteriores } else { print("Error al crear token") } ``` -------------------------------- ### Delete Subscription Plan by ID with Epayco SDK Source: https://context7.com/epayco/sdk_ios/llms.txt Removes a subscription plan from the system. Active subscriptions associated with the plan must be handled prior to deletion. Ensure the Epayco SDK is initialized. ```swift let epayco = Epayco(publicKey: "TU_LLAVE_PUBLICA", privateKey: "TU_LLAVE_PRIVADA", lang: "ES", test: true) // Eliminar plan por ID let removeResult = epayco.plan.remove(planId: "plan-premium-mensual") if let result = removeResult { print("Plan eliminado: \(result)") } else { print("Error al eliminar plan") } ```