Options
All
  • Public
  • Public/Protected
  • All
Menu

Will allow us to use the methods related to addresses where we can perform the following actions: create a user address, get shipping addresses, edit address and delete address

Hierarchy

Index

Constructors

Methods

  • Allows to create the address of the user

    Parameters

    Returns Promise<ResponseSdk<Address>>

    with data or errors.

    country: Represents the country code under ISO 3166-1 alpha 2

    const {data, error} = await checkout.createAddress({
    first_name: 'Jhon',
    last_name: 'Doe',
    phone: '+59 663663663',
    identity_document: '1150218418',
    lat: -0.1637022,
    lng: -78.499344,
    address1: 'El Bosque, Quito, Ecuador',
    address2: 'casa',
    city: 'Quito',
    zipcode: '2040E',
    state_name: 'Pichincha',
    state_code: "SS12",
    country: 'EC',
    address_type: 'home',
    additional_description: 'casa',
    is_default: false,
    is_billing_address: false
    })
  • Allows you to delete an address

    Parameters

    • id: number

      As a parameter for this method you must enter the "id" of the address you want to delete.

    Returns Promise<ResponseSdk<Response200>>

    const { data, error } = await checkout.deleteAddress(1002)
    
  • Allows you to edit the user's address

    Parameters

    • id: number
    • payload: AddressPayload

      As parameters for this method, you need to enter the address id and the payload of the new address to edit.

    Returns Promise<ResponseSdk<Address>>

     const addressPayload = {
    first_name: 'Jhon',
    last_name: 'Doe',
    phone: '+59 663663663',
    identity_document: '1150218418',
    lat: -0.1637022,
    lng: -78.499344,
    address1: 'El Bosque, Quito, Ecuador',
    address2: 'casa',
    city: 'Quito',
    zipcode: '2040E',
    state_name: 'Pichincha',
    state_code: "SS13",
    country: 'EC',
    address_type: 'home',
    additional_description: 'casa',
    is_default: false,
    is_billing_address: false
    }
    const { data, error } = await checkout.editAddress(1093, addressPayload);
  • Allows you to get all the shipping addresses of the user

    Returns Promise<ResponseSdk<ResponseInData<Address[]>>>

    const { data, error } = await checkout.getAddresses();
    

Generated using TypeDoc