Options
All
  • Public
  • Public/Protected
  • All
Menu

Will allow us to handle the purchase processing with the following methods get order, get shipping rate, retrieve order process payments, establish billing address, declare your payment method, declare your tokenized card, payment verification, declare credit card, set guest email, get financial institution, apply coupons, remove coupons, get shipping methods, set scheduled date, get fees

Hierarchy

  • order-model

Index

Constructors

Methods

  • It allows you to apply a coupon to an order.

    Parameters

    • couponCode: string

    Returns Promise<ResponseSdk<Response200>>

      const order = await checkout.getOrderTokenized("1b753a67-ed2c-4cdb-9f8e")
    await order.data?.applyCoupon("CUP01")
  • It allows you to get getInstallments

    Parameters

    • bin: string

      the bin are the first 6 digits of the credit card

        const {data, error} = await checkoutOrderModel.getInstallments("bin")
      

    Returns Promise<ResponseSdk<InstallmentsResponse>>

  • It is used to obtain the state of Nequi

    Returns Promise<ResponseWithError<OrderResponse>>

      const response = await checkoutOrderModel.getNequiStatus()
    
  • Allows you to get a single order.

    Returns Order

      const order = await checkoutOrderModel.getOrder()
    
  • It allows you to get all shipping methods you currently have.

    Parameters

    Returns Promise<ResponseSdk<OrderWithShippingMethods>>

    const date = new Date();

    const addressPayload = {
    id: 100,
    user_id: "1093",
    first_name: "Jhon",
    last_name: "Doe",
    phone: "+53 663663663",
    identity_document: "42424242",
    lat: -2452302,
    lng: 05662145,
    address1: "Av. Example 123",
    address2: "Av. Examaple 234",
    city: "Quito",
    zipcode: "2040E",
    state_name: "Pichincha",
    state_code: "SS13",
    country: "Ecuador",
    address_type: "home",
    additional_description: "casa",
    is_default_address:true,
    is_last_address:true,
    is_billing_address:true,
    created_at: date,
    updated_at: date,
    deleted_at: date,
    country_code: "EC",
    }
    const {data, error} = await checkoutOrderModel.getShippingMethods(addressPayload)
  • It is used to obtain shipping rate

    Returns ShippingRate

      const response = await checkoutOrderModel.getShippingRate()
    
  • It allows us to process the payments that we currently have in process Internally, several internal methods are processed that helped in the process of purchasing an order.

    Returns Promise<ResponseSdk<ApiError> | ResponseSdk<PaymentResponse>>

      const getOrderTokenized = await checkout.getOrderTokenized("1b753a67-ed2c-4cdb")
    if(getOrderTokenized.error !== null){
    console.warn("Error getting order")
    return;
    }
    const orderModel = getOrderTokenized.data!;
    const {data, error} = await orderModel.processPayment()
  • refetchOrder(): Promise<void>
  • It allows us to retrieve the order

      const {data,error} = await checkoutOrderModel.refetchOrder()
    

    Returns Promise<void>

  • It allows us to remove a coupon from an order.

    Parameters

    • couponCode: string

    Returns Promise<ResponseSdk<Response200>>

      const order = await checkout.getOrderTokenized("1b753a67-ed2c-4cdb-9f8e")
    await order.data?.removeCoupon("CUP01")
  • It allows you to declare the payment address to an order.

    Parameters

    Returns Promise<ResponseSdk<Response200>>

      const addressPayload = {
    id: 100,
    user_id: "1093",
    first_name: "Jhon",
    last_name: "Doe",
    phone: "+53 663663663",
    identity_document: "42424242",
    lat: -2452302,
    lng: 05662145,
    address1: "Av. Example 123",
    address2: "Av. Examaple 234",
    city: "Quito",
    zipcode: "2040E",
    state_name: "Pichincha",
    state_code: "SS13",
    country: "Ecuador",
    address_type: "home",
    additional_description: "casa",
    is_default_address:true,
    is_last_address:true,
    is_billing_address:true,
    created_at: date,
    updated_at: date,
    deleted_at: date,
    country_code: "EC",
    }

    const {data,error} = await checkoutOrderModel.setBillingAddress(addressPayload)
  • setCallbackUrl(callbackUrl: string): void
  • Use this method when you need to use callbackUrl

    Parameters

    • callbackUrl: string
        const response = await checkoutOrderModel.setCallbackUrl("www.yourURL.com")
      

    Returns void

  • setCardTokenized(card: CardTokenized, cvv: string, zipcode?: string): void
  • It allows you to set a tokenized card

    Parameters

    • card: CardTokenized
    • cvv: string
    • Optional zipcode: string
      setCardTokenized
      const CardTokenized = {
      id: "",
      user_id: "",
      card_holder: "",
      card_holder_dni: "",
      token: "",
      company: "",
      last_four: "",
      first_six: "",
      expiration_date: "",
      created_at: "",
      updated_at: "",
      deleted_at: "",
      }

      const response = await checkoutOrderModel.setCardTokenized(CardTokenized,"your_cvv","your_zipcode")

    Returns void

  • setCashChange(change: number): void
  • Allows you to set the cash change

    Parameters

    • change: number
        const response = await checkoutOrderModel.setCashChange(1093)
      

    Returns void

  • Use this method if you need to pay with a card without save

    Parameters

    • card: CreditCard
        const card = {
      expiry_month: "04",
      expiry_year: "2022",
      card_holder: "Jhon Doe",
      card_holder_dni: "999999",
      card_number: "4242424242424242",
      card_cvv: "123",
      address1: "Av. example 9999",
      zip: "01823",
      city: "Guadalajara",
      state: "Jalisco",
      country: "Mexico",
      phone: "+52 999999999",
      }

      const response = await checkoutOrderModel.setCreditCard(card)

    Returns void

  • setDeviceId(deviceId: string): void
  • It allows us to set the device ID

    Parameters

    • deviceId: string
        const response = await checkoutOrderModel.setDeviceId("XXXX")
      

    Returns void

  • setFinancialInstitution(financialInstitution: string): void
  • Use this method when you need to use PSE

    Parameters

    • financialInstitution: string
        const response = await checkoutOrderModel.setFinancialInstitution("financialInstitution")
      

    Returns void

  • setGuestEmail(email: string): void
  • Use this method in case that your user is guest

    Parameters

    • email: string
        const response = await checkoutOrderModel.setGuestEmail("jhonDoe@yourmail.com")
      

    Returns void

  • It allows us to establish the quota selected by the user.

    Parameters

    • installments: Installment
        const response = await checkoutOrderModel.setInstallments(Installment)
      

    Returns void

  • It allows you to declare the payment method of an order.

    Parameters

    • paymentMethod: PaymentMethod
        const response = await checkoutOrderModel.setPaymentMethod(paymentMethod)
      

    Returns void

  • setRecaptchaToken(token: string): Promise<void>
  • Allows you to set the Recaptcha token

    Parameters

    • token: string
        const response = await checkoutOrderModel.setRecaptchaToken("1b753a67-ed2c-4cdb")
      

    Returns Promise<void>

  • Allows you to set a scheduled date

    Parameters

    Returns Promise<ResponseSdk<Response200>>

      const date = new Date();

    const addressPayload = {
    id: 100,
    user_id: "1093",
    first_name: "Jhon",
    last_name: "Doe",
    phone: "+53 663663663",
    identity_document: "42424242",
    lat: -2452302,
    lng: 05662145,
    address1: "Av. Example 123",
    address2: "Av. Examaple 234",
    city: "Quito",
    zipcode: "2040E",
    state_name: "Pichincha",
    state_code: "SS13",
    country: "Ecuador",
    address_type: "home",
    additional_description: "casa",
    is_default_address:true,
    is_last_address:true,
    is_billing_address:true,
    created_at: date,
    updated_at: date,
    deleted_at: date,
    country_code: "EC",
    }
    const scheduledData = {
    shipping_method_code: "Cod-Method",
    selected_date: "2022-04-22",
    }
    scheduledData: ScheduledData
    const response = await checkoutOrderModel.setScheduledDate(scheduledData,addressPayload)
  • It allows you to set your own shipping methods with their own rate.

    Parameters

    • methodCode: string
    • Optional addressPayload: Address

    Returns Promise<ResponseSdk<OrderResponse>>

      const date = new Date();

    const addressPayload = {
    id: 100,
    user_id: "1093",
    first_name: "Jhon",
    last_name: "Doe",
    phone: "+53 663663663",
    identity_document: "42424242",
    lat: -2452302,
    lng: 05662145,
    address1: "Av. Example 123",
    address2: "Av. Examaple 234",
    city: "Quito",
    zipcode: "2040E",
    state_name: "Pichincha",
    state_code: "SS13",
    country: "Ecuador",
    address_type: "home",
    additional_description: "casa",
    is_default_address:true,
    is_last_address:true,
    is_billing_address:true,
    created_at: date,
    updated_at: date,
    deleted_at: date,
    country_code: "EC",
    }

    const {data,error} = await checkoutOrderModel.setShippingMethod("methodCode",addressPayload)
  • It allows you to declare a shippingRate to an order.

    Parameters

    Returns Promise<ResponseSdk<Response200>>

    const date = new Date();
    const addressPayload = {
    id: 100,
    user_id: "1093",
    first_name: "Jhon",
    last_name: "Doe",
    phone: "+53 663663663",
    identity_document: "42424242",
    lat: -2452302,
    lng: 05662145,
    address1: "Av. Example 123",
    address2: "Av. Examaple 234",
    city: "Quito",
    zipcode: "2040E",
    state_name: "Pichincha",
    state_code: "SS13",
    country: "Ecuador",
    address_type: "home",
    additional_description: "casa",
    is_default_address:true,
    is_last_address:true,
    is_billing_address:true,
    created_at: date,
    updated_at: date,
    deleted_at: date,
    country_code: "EC",
    }
    const {data,error} = await checkoutOrderModel.setShippingRate(addressPayload)
  • setUserInstructions(userInstructions: string): void
  • Use this method to add user instructions to purchase

    Parameters

    • userInstructions: string
        const response = await checkoutOrderModel.setUserInstructions("userInstructions")
      

    Returns void

  • It allow us to verify payments of the order and the client in process

    Parameters

    • otpCode: string

      For this method as input parameter we enter an OTP code in string format

    Returns Promise<ResponseWithError<OrderResponse>>

      const response = await checkoutOrderModel.verifyPaymentWithOTP("otpCode")
    
  • It allow us to verify payments of the order and the client in process

    Parameters

    • otpCode: string

      For this method as input parameter we enter an OTP code in string format This method is currently deprecated

    Returns Promise<ResponseWithError<OrderResponse>>

Generated using TypeDoc